thomask
Forum Replies Created
-
i have done a workaround using filter
add_filter( 'wpseo_breadcrumb_links', 'mc_breadcrumb_filter' ); function mc_breadcrumb_filter ($links) { foreach ($links as $key => &$link) { /* ... my other filters */ if (isset($link['ptarchive']) && $link['ptarchive']==false) { global $wp_query; $link['ptarchive'] = $wp_query->query_vars['post_type']; } } return (array_values($links)); }so the problem is on line 125
$links[] = array( 'ptarchive' => get_post_type() );but the problem is, that when there is zero posts, the get_post_type returns false, as global $post returns false;
so imo it should return probably 404 or even better – there should be a special breacrumb for zero results archive pages ($post = NULL), and it’s check should be first.
So i have found the solution, now i understand your code, sorry for multiple posts 😉
give NULL to parent_slug in ass_submenu_page:
add_submenu_page(NULL, __(“Replace media”, “enable-media-replace”), ”,’upload_files’, __FILE__, ’emr_options’);
btw i do not much understand, why do you need it – i’m using attachment_fields_to_save and attachment_fields_to_edit filters for simillar function and do not need such workaround.
<del>I have found a workaround:
change capability in add_submenu_page(‘upload.php’, __(“Replace media”, “enable-media-replace”), ”,’upload_files’, __FILE__, ’emr_options’); function to anything what noone has, e.g. “xxx”
add_submenu_page(‘upload.php’, __(“Replace media”, “enable-media-replace”), ”,’xxx’, __FILE__, ’emr_options’);
</del> – it works but it than does not show the page after clicking “replace media”
but anyway i think, there is a better way to access the get parameter, e.g. admin_init action, query_vars filter etc.Notice: Undefined index: show_page in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_social.php on line 786
Notice: Undefined index: show_home in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_social.php on line 786
Notice: Undefined variable: count in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_plugin_admin.php on line 97
Notice: Undefined variable: appId in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_plugin_admin.php on line 103
etc.
699
753
796
909
850
959Notice: Undefined index: center in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 176
Notice: Undefined index: disableFloat in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 181
Notice: Undefined index: autoClose in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 182
Notice: Undefined index: loadOpen in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 183
Notice: Undefined index: skin in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 184
Notice: Undefined index: show_home in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 186
Notice: Undefined index: show_blog in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 187
Notice: Undefined index: show_post in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 188
Notice: Undefined index: show_page in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 189
Notice: Undefined index: show_category in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 190
Notice: Undefined index: show_archive in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/slick-social-share-buttons/inc/dcwp_admin.php on line 191
I told you – yoast is a king 😉
i think that yoast will take it as other bug reports and will quickly resolve it. So take it just as a quick fix
The problem is with /wordpress-seo/frontentd/class-breadcrumbs.php row 238
replace
$output .= esc_html( " $sep " );
with
$output .= " $sep " ;one bug – error notice alex in your version (not in original) on line 222
$breadcrumb_array[] = array( 'title' => $this->get_bc_title( $ancestor ), 'url' => get_permalink($ancestor), 'class' => '', 'type' => get_post_type($ancestor), 'ID' => (int) $ancestor->term_id );– $ancestor is ID, so $ancestor->term_id at the end should be just $ancestor
+1 – please Yoast, use Alex’s function, works as a charm, i have tested it and it solve several problems with your breadcrumbs, i have reported in past weeks
it works perfectly, even the new filter, thank you, i hope that yoast will implement it
as i wrote, problem is, that this particular article has no selected category, not even uncategorised (it is normaly not possible with WP), so $terms return blank array. So it should probably not happen to almost anyone, just from programming standards it would be wise to first check if $terms[0] exist then directly expect it does
So the line 190 should be
if ( is_taxonomy_hierarchical($main_tax) && isset($terms[0]) && $terms[0]->parent != 0 ) {P.S.: this is that var_dump
object(stdClass)#4254 (25) { ["ID"]=> int(3657) ["post_author"]=> string(1) "3" ["post_date"]=> string(19) "2012-06-06 19:05:57" ["post_date_gmt"]=> string(19) "2012-06-06 17:05:57" ["post_content"]=> string(0) "" ["post_title"]=> string(73) "Školení účetního programu Money S3 pro začátečníky i pokročilé" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(6) "closed" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(24) "terminy-skoleni-money-s3" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2012-06-07 15:54:52" ["post_modified_gmt"]=> string(19) "2012-06-07 13:54:52" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(36) "http://money.mediacentrum.cz/?p=3657" ["menu_order"]=> int(0) ["post_type"]=> string(4) "post" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["ancestors"]=> array(0) { } ["filter"]=> string(3) "raw" } string(8) "category" array(0) { }yes, the problem with line 226 seems solved, there is still problem with line 175 (in your version it is 189:
Notice: Undefined offset: 0 in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/wordpress-seo/frontend/class-breadcrumbs.php on line 189
Notice: Trying to get property of non-object in /var/www/vhosts/money.cz/httpdocs/wp-content/plugins/wordpress-seo/frontend/class-breadcrumbs.php on line 189)
and if your would also implement this little improvement (http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-tiny-feature-request-with-code-to-implement-breadcrumb-category-precedence?replies=1) – i would buy you a beer when you come to prague 😉