• 1. How do I turn on the display of breadcrumbs?
    2. How to turn on the display of breadcrumbs Yoast SEO?

    For example: Home / Post_Type / Category / Post_Name

Viewing 9 replies - 1 through 9 (of 9 total)
  • Theme Author creativethemeshq

    (@creativethemeshq)

    Hello Anatolii,
    1. Blocksy has a built in breadcrumbs module, you can turn it on from Page or Post Title section, see this video.

    2. Unfortunately there is no way to display the Yoast SEO breadcrumbs.
    Is there a specific use case why you want to use the Yoast breadcrumbs?

    Cheers.

    Thread Starter Anatolii Dimov

    (@xpood)

    2. I need a complete structure for breadcrumbs.

    I created my own post type with taxonomy and changed the structure for url.

    <?php
    /*
    * Plugin Name: MOD
    * Description: DEV
    */
    
    /** Создание произвольного типа записи
     * - Услуги
     * - cpt_mod_services()
     */
    add_action('init', 'cpt_mod_services', 0);
    function cpt_mod_services()
    {
    	// регистрация типа записи
        register_post_type('mod_services', array(
            'labels'       => array(
    			'name'                     => 'Услуги',
            ),
            'public'       => true,
            'has_archive'  => true,
            'rewrite'      => array('slug' => 'services', 'with_front' => false),
            'supports'     => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'post-formats'),
            'query_var'    => true,
            'show_in_rest' => true,
        ));
    	// регистрация таксономии
        register_taxonomy('mod_services_categories', array('mod_services'), array(
            'labels'       => array(
    			'name'                     => 'Категории услуг',
            ),
            'public'       => true,
            'hierarchical' => true,
            'rewrite'      => array('slug' => 'services', 'hierarchical' => true, 'with_front' => false),
            'query_var'    => true,
            'show_in_rest' => true,
        ));
    
        flush_rewrite_rules();
    }
    
    /** Изменения структуры ссылок записей
     * - services_permastruct()
     */
    add_filter('post_type_link', 'services_permastruct', 1, 2);
    function services_permastruct($permalink, $post)
    {
        if (strpos($permalink, 'services') === false) return $permalink;
        $terms = get_the_terms($post, 'mod_services_categories');
        if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) {
            $taxonomy_slug = get_term_parents_list($terms[0]->term_id, 'mod_services_categories', array(
                'separator' => '/', 'format' => 'slug', 'link' => false, 'inclusive' => true
            ));
            $taxonomy_slug = trim($taxonomy_slug, '/');
        } else {
            $taxonomy_slug = 'catalog';
        }
        return str_replace('services', 'services/' . $taxonomy_slug, $permalink);
    }
    
    /** Создание нового правила перезаписи
     * - taxonomy_slug_rewrite()
     */
    add_filter('generate_rewrite_rules', 'taxonomy_slug_rewrite');
    function taxonomy_slug_rewrite($wp_rewrite)
    {
        $rules = array();
        $taxonomies = get_terms(array(
            'taxonomy' => 'mod_services_categories', 'hide_empty' => false
        ));
        foreach ($taxonomies as $taxonomy) {
            $taxonomy_slug = get_term_parents_list($taxonomy->term_id, 'mod_services_categories', array(
                'separator' => '/', 'format' => 'slug', 'link' => false, 'inclusive' => true
            ));
            $rules['^services/' . $taxonomy_slug . '?$'] = 'index.php?' . $taxonomy->taxonomy . '=' . $taxonomy->slug;
        }
        $rules['^services/([^/]*)/?$'] = 'index.php?mod_services_categories=$matches[1]';
        $rules['^services/(.+?)/page/?([0-9]{1,})/?$'] = 'index.php?mod_services_categories=$matches[1]&paged=$matches[2]';
        $rules['^services/(.+?)/([^/]*)/?$'] = 'index.php?mod_services=$matches[2]';
        $wp_rewrite->rules = $rules + $wp_rewrite->rules;
    }
    
    /** Обновление правил перезаписи при создании/удалении/изменении таксономий
     * - reset_rewrite_rules()
     */
    add_action('created_mod_services_categories', 'reset_rewrite_rules');
    add_action('delete_mod_services_categories', 'reset_rewrite_rules');
    add_action('edited_mod_services_categories', 'reset_rewrite_rules');
    function reset_rewrite_rules()
    {
        flush_rewrite_rules();
    }

    It should be – https://ibb.co/F04p8Xj
    Yoast settings breadcrumbs – https://ibb.co/x6TnkDm
    Missing post_type – https://ibb.co/vkTKkQ1

    How to add Post_Type?

    Theme Author creativethemeshq

    (@creativethemeshq)

    @xpood Thanks for details, we reproduced this problem and will have a fix for this in the next update. Please let us know if you need a solution for this sooner.

    Thread Starter Anatolii Dimov

    (@xpood)

    Thanks, I’m waiting for the update.

    Thread Starter Anatolii Dimov

    (@xpood)

    I thank you for updating 1.7.25.

    I have another problem with bread crumbs.
    I disabled archives in CUSTOM_POST_TYPE (‘has_archive’ => false,), due to 404 errors, in pagination (../services/page/2/).

    I created a page (services page) with a shortcut (services), now I need to insert it into breadcrumbs.

    For example-1

    register_post_type ('mod_services', array (
            'labels' => array ('name' => 'services cpt'),
            'has_archive' => true,
    ...
    ));

    img-1 – https://ibb.co/Bj0Trhj

    For example-2
    'has_archive' => false
    img-2 – https://ibb.co/FWPK6KK

    Is it possible to implement this in Blocksy?
    I apologize for my english. I am writing to you via translate.google.

    Theme Author creativethemeshq

    (@creativethemeshq)

    Hi @xpood,

    Ah, I see. Now the CPT items appears in breadcrumbs only when you have has_archive => true for that custom post type.

    The thing is, you don’t only need to insert it to breadcrumbs, you need to insert it on the right pages and in the right position (after the HOME element). We’ll try to make a filter for this and include it in the next update.

    Will have a reply in this thread about how to use it.

    And no worries about your English, we can perfectly understand you 😉

    Theme Author creativethemeshq

    (@creativethemeshq)

    Hi @xpood,

    With the release of Blocksy 1.7.27, we’ll introduce the blocksy:breadcrumbs:items-array filter, with which you’ll be able to manually add your breadcrumbs item, the way you wanted.

    Here’s an example of the way this filter should be called, you can take this example and adjust it for your needs and it’ll work just fine: https://gist.github.com/andreiglingeanu/10f4777b54c28e65b3116bedf44b8c7c

    For this snippet to work now you need to wait until we make the update (hopefully today or tomorrow) or just let me know and I’ll give you the build directly.

    Hope this helps!

    Thread Starter Anatolii Dimov

    (@xpood)

    Thanks for the help. I really appreciate this.
    Added a new filter to the plugin and everything worked as it should.

    Love you!!!

    Theme Author creativethemeshq

    (@creativethemeshq)

    @xpood you’re welcome 😉

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Breadcrumbs are not displayed’ is closed to new replies.