- This topic has 31 replies, 3 voices, and was last updated 4 years, 1 month ago by
David.
-
AuthorPosts
-
February 26, 2022 at 9:12 am #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_actioncalls did not help.February 26, 2022 at 10:13 am #2134712Aaron
Excerpt is enabled and works with the core query block
February 26, 2022 at 10:46 am #2134741David
StaffCustomer SupportHmmm… 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 ?February 26, 2022 at 3:03 pm #2134922Aaron
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.
February 27, 2022 at 4:21 am #2135206David
StaffCustomer SupportOK 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
February 28, 2022 at 4:15 pm #2137174Aaron
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.
March 1, 2022 at 3:51 am #2137651David
StaffCustomer SupportCan 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
March 1, 2022 at 3:59 am #2137661Aaron
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?
March 1, 2022 at 4:49 am #2137740David
StaffCustomer SupportWhich version of WP are you running ?
March 1, 2022 at 4:50 am #2137742Aaron
5.9.1
March 1, 2022 at 5:01 am #2137758David
StaffCustomer SupportHmmm… 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/
March 1, 2022 at 5:19 am #2137788Aaron
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 ButtonMarch 1, 2022 at 5:46 am #2137820David
StaffCustomer SupportMade 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.
March 1, 2022 at 5:56 am #2137831Aaron
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?
March 1, 2022 at 6:31 am #2137863David
StaffCustomer SupportSimplest method is a little CSS:
.entry-summary p:not(.read-more-container) { display: none; } -
AuthorPosts
- You must be logged in to reply to this topic.