Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorlugano
    • CommentTimeMar 10th 2010 edited
     permalink
    Hi all,
    This code solves the problem of canonical pages in WP. Add in functions.php of theme.
    Here: http://yoast.com/wordpress/canonical/ is a plugin...

    function set_canonical() {
    if ( is_single() ) {
    global $wp_query;
    echo '<link rel="canonical" href="'.get_permalink($wp_query->post->ID).'"/>';
    }
    }
    add_action('wp_head', 'set_canonical');


    Some change to make this code work in Flat Press?.. Thanks!.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 11th 2010 edited
     permalink
    something along these lines:

    function set_canonical() {
    global $fpdb;
    $q =& $fpdb->getQuery();
    if ($q->params->entry) { //is single
    list($id, $e) = @$q->peekEntry();
    if ($e) echo '<link rel="canonical" href="'.get_permalink($id).'"/>';
    }

    }
    add_action('wp_head', 'set_canonical');
    •  
      CommentAuthorlugano
    • CommentTimeMar 18th 2010
     permalink
    Hi NoWhereMan,

    this plugin canonical not working in flatpress.
    thanks.
    •  
      CommentAuthorNoWhereMan
    • CommentTimeMar 19th 2010
     permalink
    Posted By: luganothis plugin canonical not working in flatpress.


    can you be more specific?
    •  
      CommentAuthorlugano
    • CommentTimeMar 21st 2010 edited
     permalink
    Hi, NoWhereMan, if, sorry. You're right.
    I create a plugin.canonical, activated, but did not work. (activated prettyurls).

    Must work for the pager, for comments, etc.. Example:
    http://zeuder.com.ar/ (take as example this website - thanks webmaster)

    (identical content - duplicate page)

    zeuder.com.ar - Title and content identical : zeuder.com.ar/2010/ -> url Cannonical is zeuder.com.ar

    zeuder.com.ar/category/themes/ - Title: The zeuder Blog
    zeuder.com.ar/category/themes/page/2/ - title: The blog of zeuder -> url Cannonical is zeuder.com.ar/category/themes/
    or Title: The zeuder Blog - page 2

    zeuder.com.ar/2010/03/01/windows-trabajando-con-menos-de-256-mb/ and
    zeuder.com.ar/2010/03/01/windows-trabajando-con-menos-de-256-mb/comments/ idem. etc...

    If it works well, this will solve big problems
    Thank you very much.