Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/class-categories-switcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct() {
* @param array $params An array of parameters for the Categories Switcher component.
*/
public function render( $params = array() ) {
if ( $this->query->is_browse_listings_page() || $this->query->is_browse_categories_page() ) {
if ( $this->query->is_browse_listings_page() ) {
$action_url = awpcp_current_url();
} else {
$action_url = awpcp_get_browse_categories_page_url();
Expand Down
2 changes: 1 addition & 1 deletion frontend/class-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function is_page_that_has_shortcode( $shortcode ) {
}

public function is_browse_categories_page() {
return $this->is_browse_listings_page();
return $this->is_page_that_has_shortcode( 'AWPCPBROWSECATS' );
}

public function is_renew_listing_page() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function maybe_redirect_frontend_request() {
return;
}

if ( $this->query->is_browse_listings_page() || $this->query->is_browse_categories_page() ) {
if ( $this->query->is_browse_listings_page() ) {
$this->maybe_redirect_browse_listings_request();
return;
}
Expand Down
23 changes: 21 additions & 2 deletions frontend/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function init() {
add_shortcode( 'AWPCPPAYMENTTHANKYOU', array( $this, 'noop' ) );
add_shortcode( 'AWPCPCANCELPAYMENT', array( $this, 'noop' ) );

add_shortcode( 'AWPCPBROWSECATS', array( $this->browse_ads, 'dispatch' ) );
add_shortcode( 'AWPCPBROWSECATS', array( $this, 'browse_categories' ) );
add_shortcode( 'AWPCPBROWSEADS', array( $this->browse_ads, 'dispatch' ) );

add_shortcode( 'AWPCPSHOWAD', array( $this, 'show_ad' ) );
Expand Down Expand Up @@ -141,6 +141,25 @@ public function search_ads() {
return $this->output['search-ads'];
}

/**
* Renders the View Categories list (same UI as main-page layout=2).
*
* Previously aliased to Browse Ads for backwards compatibility.
*
* @since x.x
*
* @return string
*/
public function browse_categories() {
if ( ! isset( $this->output['browse-categories'] ) ) {
awpcp_enqueue_main_script();

$this->output['browse-categories'] = awpcp_display_the_classifieds_page_body( '' );
}

return $this->output['browse-categories'];
}

public function reply_to_ad() {
if ( ! isset( $this->output['reply-to-ad'] ) ) {
do_action( 'awpcp-shortcode', 'reply-to-ad' );
Expand Down Expand Up @@ -492,7 +511,7 @@ function awpcp_get_menu_items( $params ) {
}

if ( $show_browse_ads_item ) {
if ( awpcp_is_browse_listings_page() || awpcp_is_browse_categories_page() ) {
if ( awpcp_is_browse_listings_page() ) {
if ( get_awpcp_option( 'main_page_display' ) ) {
$browse_cats_url = awpcp_get_view_categories_url();
} else {
Expand Down
Loading