About the shortcodes_adverts_list() function
-
Greg, the ‘Search’ and ‘Location’ fields on adverts lists are displayed only by the list.php template? … that is included by adverts/includes/shortcodes.php shortcodes_adverts_list()? I supose the answer is ‘yes’.
I needed to customize the list.php template, so I created an own plugin that overrides the original shortcodes_adverts_list():
add_action( 'wp_loaded', 'override_adverts_list_shortcode' ); function override_adverts_list_shortcode() { remove_shortcode( 'adverts_list' ); add_shortcode( 'adverts_list', 'custom_shortcode_adverts_list' ); }
then I copied the original code to the new function and just changed this:
// adverts/templates/list.php ob_start(); include_once ADVERTS_PATH . 'templates/list.php'; return ob_get_clean();
to this:
// adverts/templates/list.php ob_start(); include_once( plugin_dir_path( __FILE__ ) . '/templates/list.php'); return ob_get_clean();
so the WP Adverts now loads my customized list.php template.
What was customized at this moment I described partially here and this is related to my question. The problem is that this customization works only on the main adverts list page, but not on adverts lists for separate categories – see this (main adverts list) and see this (a category adverts list)). It seems that when a category adverts list page is loaded is used the original shortcodes_adverts_list() and, respectively, the original list.php template, not that I customized. What I am doing wrong here? Can you suggest the right direction of solving this?
Regards,
Iurie
- The topic ‘About the shortcodes_adverts_list() function’ is closed to new replies.