• If you use the WordPress built-in gallery option to insert bunch of images together into post, you might have stumbled upon the following problem.

    When making the gallery, if you have selected the thumbs to go to “attachment page” instead of to the image directly. (Which means that it opens the full sized image in a page instead the image directly.) You might have noticed that the <title> </title> tag of this page is something like:

    <title>The title of the post – the title of the image – the title of the blog. </title>

    Which is quite long, and if both 3 are on the same topic, it might look like keyword stuffing.

    So i’m looking for a way to make WordPress show just the title of the image in the <title> </title> tag of those attachment pages!

    Infact, i’m willing to paypal $20 to the one who give me the solution!
    🙂

    p.s.
    things that i’ve tried that don’t work
    – getting the original header.php code for the titles from the twentyten theme and replacing it in my current theme > it still outputs the same, so doesn’t seem like it’s controlled from there.
    – adding attachment.php page, copied the original one from the twenty ten theme and added to my current theme, it changes the layout of the page but NOT the title
    – plug-ins like All in One Seo Pack controll all the other pages titles but NOT the attachment page

Viewing 1 replies (of 1 total)
  • Thread Starter Fking

    (@fking)

    After few days testing and hiring an WordPress expert to look into it, we actually found that All in one SEO pack wasn’t allowing the title to be output as set in header.php for the attachment page.
    So we added a condition in aioseop.class.php in this function:
    function template_redirect() {
    global $wp_query;
    global $aioseop_options;
    $post = $wp_query->get_queried_object();
    if( $this->aioseop_mrt_exclude_this_page()){
    return;
    }
    //ADDED BY US this condition only
    if(is_attachment()) {
    return;
    }
    if (is_feed()) {
    return;
    }
    if (is_single() || is_page()) {
    $aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, ‘_aioseop_disable’, true)));
    if ($aiosp_disable) {
    return;
    }
    }
    It took me a lot of time and some money to figure out this, so i hope it might be helpful to someone else.
    Also it will be great if we can get it included in next version so i don’t have to fix it every time i update this plug-in, and i use it for quite a lot of sites 🙂

Viewing 1 replies (of 1 total)
  • The topic ‘How to control the page titles when using the WP gallery’ is closed to new replies.