Home › Forums › WoodMart support forum › Blog page doesnt show posts
Blog page doesnt show posts
- This topic has 6 replies, 2 voices, and was last updated 8 months ago by Hung Pham.
-
AuthorPosts
-
April 9, 2024 at 1:00 pm #555984
leitmotivmediaParticipantPosts published do not appear on the blog page
April 9, 2024 at 1:06 pm #555985
leitmotivmediaParticipantAccess in private content
April 10, 2024 at 8:15 am #556192
Hung PhamKeymasterHi leitmotivmedia,
Thanks for reaching to us.
Would you mind if I deactivate extra plugins for testing? Please confirm me back.
Regards,
April 10, 2024 at 10:04 am #556231
leitmotivmediaParticipantplease, test, whatever you need
April 11, 2024 at 11:48 am #556489
Hung PhamKeymasterHi leitmotivmedia,
Thanks for your confirmation.
I switched to Parent theme and it worked again, so please remove custom code lines related to Blog page then check again.
Regards,
April 11, 2024 at 12:30 pm #556513
leitmotivmediaParticipantThank you so much.
It is true, the problem was a function that I have added in function.php
It is a function for the URL of non -including sub folders
That way instead of myysite.com/products/my-first-product
The URL is mysite.com/my-first-productCan it be done in some way so that it does not affect the blog?
/* Quitar producto del slug de productos de WooCommerce */
function ayudawp_quitar_slug_producto( $post_link, $post, $leavename ) {
if ( ‘product’ != $post->post_type || ‘publish’ != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( ‘/producto/’, ‘/’, $post_link );
return $post_link;
}
add_filter( ‘post_type_link’, ‘ayudawp_quitar_slug_producto’, 10, 3 );
function change_slug_struct( $query ) {
if ( ! $query->is_main_query() || 2 != count( $query->query ) || ! isset( $query->query[‘page’] ) ) {
return;
}
if ( ! empty( $query->query[‘name’] ) ) {
$query->set( ‘post_type’, array( ‘post’, ‘product’, ‘page’ ) );
} elseif ( ! empty( $query->query[‘pagename’] ) && false === strpos( $query->query[‘pagename’], ‘/’ ) ) {
$query->set( ‘post_type’, array( ‘post’, ‘product’, ‘page’ ) );
$query->set( ‘name’, $query->query[‘pagename’] );
}
}
add_action( ‘pre_get_posts’, ‘change_slug_struct’, 99 );April 12, 2024 at 10:12 am #556729 -
AuthorPosts
- You must be logged in to create new topics. Login / Register