MarketPress 2.3.1 generated "products" page shows no title

At first I thought it was my theme and/or the customized layouts I was generating via mp_productlist.php, then I checked with twentyeleven and it still shows just the site name w/o a page title.

Also, where do I submit patches? I found an issue in the templating functions where the $echo parameter wasn't being used to decide whether to echo or return the value. (I don't have that in front of me, but can submit that where ever...)

Thanks!

  • RichardHK
    • Flash Drive

    Wayne/Aaron,

    I had exact same 'page title in header' problem with my Catalyst theme and the Catalyst developer (Eric Hamm) supplied the following explanation and fix:

    So after poking around your site and Theme/Plugin files for a bit I was able to determine the issue and that is that the Marketpress Plugin is filtering in their title in such a way that it conflicts with how Catalyst filters it in. I'm not saying it's a bug on their part, necessarily, just a conflict between the two products.

    So the fix was to remove a Catalyst filter and then re-add it at a different priority so it not longer conflicts, using the two lines of code below (I added this code to your /wp-content/themes/dynamik/custom-functions.php file):

    remove_filter( 'wp_title', 'catalyst_site_title_wrap', 20 );
    add_filter( 'wp_title', 'catalyst_site_title_wrap', 100 );

    Now I know it is not Genesis code, but it should give you programmers a good lead to fix the conflict.

  • WayneBuckhanan
    • WPMU DEV Initiate

    I appreciate the feedback, Richard.

    I discovered that when MP checks for the custom template for the cart and order status, it adds a wp_title filter with priority 99. (Lines 939 and 968 in MP 2.3.1.)

    When I change the priority to be less than 20, voila, I get my titles back.

    Since this has happened on multiple themes (looks like catalyst is filtering at priority 20 also), I wonder if MP needs to change that to priority 19 rather than 99. Not sure what other possible repercussions that may have, but that's my slightly-informed suggestion.

    Otherwise, a note that themes may need to play with filters would be useful.

    Thanks to both of you!

  • Aaron
    • CTO

    Thanks!

    not sure what other possible repercussions that may have, but that's my slightly-informed suggestion.

    This is a tricky one. I don't recall why I chose 99, I think the idea was that no matter the theme's priority MP would be able to override. But in these advanced custom frameworks they are doing some really strange things with the title. I'm really curious to see the code that is tying into that filter, care to paste it?

  • WayneBuckhanan
    • WPMU DEV Initiate
    % grep -r wp_title genesis
    genesis/lib/structure/header.php:add_filter( 'wp_title', 'genesis_doctitle_wrap', 20 );
    genesis/lib/structure/header.php:add_action( 'genesis_title', 'wp_title' );
    genesis/lib/structure/header.php:add_filter( 'wp_title', 'genesis_default_title', 10, 3 );
    genesis/lib/functions/seo.php:	remove_filter('wp_title', 'genesis_default_title', 10, 3);
    genesis/lib/functions/seo.php:		remove_filter('wp_title', 'genesis_default_title', 10, 3);
    genesis/lib/functions/seo.php:		remove_action('genesis_title', 'wp_title');

    From genesis/lib/structure/header.php:

    add_filter( 'wp_title', 'genesis_doctitle_wrap', 20 );
    /**
     * This function wraps the doctitle in <title></title> tags.
     *
     * @since unknown
     *
     * @param string $title
     * @return string Plain text or HTML markup
     */
    function genesis_doctitle_wrap( $title ) {
            return is_feed() || is_admin() ? $title : sprintf( "<title>%s</title>\n", $title );
    }

    So, it sort of makes sense that if you set the title after genesis has wrapped it, then you get just the contents of the title, instead of the wrapped version.

    Who knows what is happening in other themes/frameworks...
    (I don't envy your commitment to support everything out there!)

    Thanks!

  • Aaron
    • CTO

    Well that would explain it. I can't think for the life of me why they use a filter to add the title tags around it instead of just including title tags in the template like every other theme!

    I'll see if there are any repercussions lowering the priority to 19 in the plugin.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.