maxbuxfiy
Forum Replies Created
-
Forum: Plugins
In reply to: [Yoast SEO] Serious Canonical Issue with Paginated PostsI don’t know if Yoast saw this so I will mark as resolved and maybe file a bug report.
Forum: Plugins
In reply to: [Yoast SEO] Serious Canonical Issue with Paginated PostsI don’t know if Yoast saw this so I will mark as resolved and maybe file a bug report.
Forum: Plugins
In reply to: [Yoast SEO] Serious Canonical Issue with Paginated PostsOK, I went through the code and found out Yoast made a logical error, maybe he needs more coffee or something ??
On line 575 of class-frontend.php under the comment // Fix paginated pages canonical, but only if the page is truly paginated.
$numpages = substr_count( $obj->post_content, '<!--nextpage-->' ) + 1; if ( $numpages && get_query_var( 'page' ) < $numpages ) {
He forgot to cater for the last page in paginated which will be equal to
$numpages
Just add ‘=’ so it reads
if ( $numpages && get_query_var( 'page' ) <= $numpages ) {
All set.
Forum: Networking WordPress
In reply to: Keep www for root domainI have a meeting with the owner tomorrow and will explain this more ?? Hope he understands. Thanks. I will mark this as resolved.
Forum: Networking WordPress
In reply to: Keep www for root domainThanks, I know about this. But I am dealing with someone (the owner) who is adamant on keeping the www in place ?? Is there a work around?
BTW, thanks for the fast reply
Thanks Yoast
Yes, as I stated in the initial post, the issue arises when I paginate posts. Everyone is worried for their site these days (Panda, Penguin and all ??
@yoast if I set the title when publishing (SEO Title), wouldn’t that override the default template settings?
I have tried using
<title><?php wp_title(''); ?></title>
in my header and
%%title%% | %%page%%
in the title template and I only get %%title%% |
The page number is not generated. Also, if i set the SEO title, only the title is returned.I just tested Atahualpa 3.7.7 on my development server an its works fine.
Remember the page numbers will show only on paginated posts, if you are looking at page 1 they will not show. Here is where I posted in Atahualpa functions.php
[Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
which theme are you using?
if ( ! function_exists( 't5_add_page_number' ) ) { function t5_add_page_number( $s ) { global $page; $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ! empty ( $page ) && 1 < $page && $paged = $page; $paged > 1 && $s .= ' | ' . sprintf( __( 'Page: %s' ), $paged ); return $s; } add_filter( 'wp_title', 't5_add_page_number', 100, 1 ); add_filter( 'wpseo_metadesc', 't5_add_page_number', 100, 1 ); }
Paste this as it is in your functions.php. Do not place php opening and closing tags on this. BUT DO NOT place it inside another function
The code goes in your functions.php file
New solution. You can use filters and avoid redoing the whole processing when upgrading. Take a look at the second answer.
Add Page number to Meta Description in WordPress SEO by Yoast
Seems Yoast won’t fix this anytime soon so we have to do it ourselves.
I am not a programmer so if there are easier ways to do this, suggestions are welcome.
Fixing the titles:
In your templates’ header.php where Yoast suggests you place,
<title><?php wp_title(''); ?></title>
Replace it with
<title><?php wp_title(''); if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s'), max( $paged, $page ) ); ?></title>
This will place | Page 2 and so on if your post is paginated and will leave the title unchanged on the first page.
Fixing Meta descriptiosn
In WordPress SEO folder (plugin directory) you need to edit class-frontend.php (inside frontend folder).
Find
function metadesc
around line 537.On line 541 where it reads
global$post, $wp_query;
add $page so it reads
global $post, $wp_query, $page;
Scroll down to line 586, it should read
$metadesc = apply_filters( 'wpseo_metadesc', trim( $metadesc ) );
Bellow this line add
if ($page >= 2){ $page_number = ' | Page '.$page; }
Then on line 594 where it reads:
echo '<meta name="description" content="'.esc_attr( strip_tags( stripslashes( $metadesc ) ) )'"/>'."\n";
add the $page_number variable. It then should read:
echo '<meta name="description" content="'.esc_attr( strip_tags( stripslashes( $metadesc ) ) ).$page_number.'"/>'."\n";
This works just like the title, it will check if the page is greater or equal to 2 and if the result is true, it will append the page number to the $page_number variable.
The | Page is echoed as it is to prevent striping the whitespaces. You can change | to – or : or any other character you wish. It’s just a separator, however you should leave the space before and after | Page
Hope this helps. Its working for me. Remember, if you upgrade the plugin or change your theme, you have to redo this.
Forum: Fixing WordPress
In reply to: Output Different Custom Fields SeparatelySorry guys, they are both working. It was an issue of “too much caching”.
Cleared all the caches and things are OK.
Thank you