Site logo

[Resolved] tag archive has no read more label

Home Forums Support [Resolved] tag archive has no read more label

Home Forums Support tag archive has no read more label

Viewing 15 posts - 16 through 30 (of 32 total)
  • Author
    Posts
  • #2134658
    Aaron

    It is actually not a custom post type, it is the default renamed Post Post-Type. I did

    
    function plgd_adjustPostLabel()
    {
        global $menu;
        global $submenu;
        $menu[5][0] = 'Products';
        $submenu['edit.php'][5][0] = esc_html__('All Products', 'plgd');
        $submenu['edit.php'][10][0] = esc_html__('Create Product', 'plgd');
        $submenu['edit.php'][16][0] = esc_html__('Tags', 'plgd');
    }
    function plgd_adjustPostObject()
    {
        global $wp_post_types;
        $wp_post_types['post']->menu_icon = 'dashicons-store';
        $labels = &$wp_post_types['post']->labels;
        $labels->name = esc_html__('Products', 'plgd');
        $labels->singular_name = esc_html__('Product', 'plgd');
        $labels->add_new = esc_html__('Add New', 'plgd');
        $labels->add_new_item = esc_html__('Add New Product', 'plgd');
        $labels->edit_item = esc_html__('Edit Product', 'plgd');
        $labels->new_item = esc_html__('New Product', 'plgd');
        $labels->view_item = esc_html__('View Product', 'plgd');
        $labels->view_items = esc_html__('View Products', 'plgd');
        $labels->search_items = esc_html__('Search Products', 'plgd');
        $labels->not_found = esc_html__('No products found.', 'plgd');
        $labels->not_found_in_trash = esc_html__('No products found in Trash.', 'plgd');
        $labels->all_items = esc_html__('All Products', 'plgd');
        $labels->archives = esc_html__('Product Archive', 'plgd');
        $labels->attributes = esc_html__('Product Attributes', 'plgd');
        $labels->insert_into_item = esc_html__('Insert into product', 'plgd');
        $labels->uploaded_to_this_item = esc_html__('Uploaded to this product', 'plgd');
        $labels->featured_image = esc_html__('Product image', 'plgd');
        $labels->set_featured_image = esc_html__('Set product image', 'plgd');
        $labels->remove_featured_image = esc_html__('Remove product image', 'plgd');
        $labels->use_featured_image = esc_html__('Use as product image', 'plgd');
        $labels->filter_items_list = esc_html__('Filter products list', 'plgd');
        $labels->items_list_navigation = esc_html__('Products list navigation', 'plgd');
        $labels->items_list = esc_html__('Products list', 'plgd');
        $labels->item_published = esc_html__('Product published.', 'plgd');
        $labels->item_published_privately = esc_html__('Product published privately.', 'plgd');
        $labels->item_reverted_to_draft = esc_html__('Product reverted to draft.', 'plgd');
        $labels->item_scheduled = esc_html__('Product scheduled.', 'plgd');
        $labels->item_updated = esc_html__('Product updated.', 'plgd');
        $labels->item_link = esc_html__('Product Link', 'plgd');
        $labels->item_link_description =esc_html('A link to a Product.', 'plgd');
        $labels->menu_name = esc_html__('Products', 'plgd');
        $labels->name_admin_bar = esc_html__('Procduct', 'plgd');
    
    }
    
    add_action('admin_menu', 'plgd_adjustPostLabel');
    add_action('init', 'plgd_adjustPostObject');
    

    removing the add_action calls did not help.

    #2134712
    Aaron

    Excerpt is enabled and works with the core query block

    #2134741
    David
    Staff
    Customer Support

    Hmmm… odd one. If i switch from Excerpt to Content then it works correctly.
    What happens if you add a manual excerpt to one of the posts ?

    #2134922
    Aaron

    i did add an excerpt to https://plgd-trading.com/product/super-gran-reserva/ which is fully displayed no matter the word count value, but there is still no read more link.

    #2135206
    David
    Staff
    Customer Support

    OK so that part of the excerpt functions are still working ( manual excerpts don’t automatically display Read More ) which i kinda expected it not to… still a head scratcher as to why no auto excerpt is displayed.

    Before we start looking at other options – can you confirm there is not a Plugin conflict by temporarily disabling all plugins apart from GPP and GB

    #2137174
    Aaron

    I just rechecked. I disabled all plugin apart from GPP GB and GBP, and switched to the parent GP theme. Still no auto excerpt and read more…

    I will keep it in this state for now, so we can make absolutely sure it’s not some custom code or plugin.

    #2137651
    David
    Staff
    Customer Support

    Can you try creating a new ‘product’ post and just add plain text – no container blocks or other block content. As it may be related to how WP deals with nested block content in the excerpt

    #2137661
    Aaron

    See: https://plgd-trading.com/product/tag/86-arabica/

    As it may be related to how WP deals with nested block content in the excerpt

    Seems correct. The Button is now available. Where do we go from here?

    #2137740
    David
    Staff
    Customer Support

    Which version of WP are you running ?

    #2137742
    Aaron

    5.9.1

    #2137758
    David
    Staff
    Customer Support

    Hmmm… i thought they had patched that… seems it won’t work with content inside containers 2 levels deep.
    What happens if you add this PHP Snippet:

    add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
    function tu_excerpt_metabox_more( $excerpt ) {
        $output = $excerpt;
    
        if ( !has_excerpt() && '' === $output ) {
            $output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s">%3$s</a></p>',
                $excerpt,
                get_permalink(),
                __( 'Read more', 'generatepress' )
            );
        }
    	
        return $output;
    }

    This should output the button if there is no excerpt.

    The alternative to this is to create your own Content Template:

    https://docs.generatepress.com/article/block-element-content-template/

    #2137788
    Aaron

    What happens if you add this PHP Snippet:

    See https://plgd-trading.com/product/tag/86-arabica/

    1: Post without Block Content, no manual excerpt; 2 Buttons
    2: Post with Block-Content, manual excerpt; 0 Buttons
    3: Post with Block Content, no manual excerpt: 1 Button

    #2137820
    David
    Staff
    Customer Support

    Made a change to the snippet above so it also checks if the auto excerpt if empty.

    And to note – this line:

    __( 'Read more', 'generatepress' )

    Is where you can change the label.

    #2137831
    Aaron

    https://docs.generatepress.com/article/block-element-content-template/

    I like that. But since we’ve come so far, is there any chance to get rid of the 3 dots from the excerpt?

    #2137863
    David
    Staff
    Customer Support

    Simplest method is a little CSS:

    .entry-summary p:not(.read-more-container) {
        display: none;
    }
Viewing 15 posts - 16 through 30 (of 32 total)
  • You must be logged in to reply to this topic.