Compare a CPT post with a normal post

I tried to write something like this, but set in the functions of child theme I got php error: I know there are bugs here but I say ‘something like this’ $current_title = get_the_title(); $post = new WP_Query( array( ‘post_type’ => ‘attivita’, ‘posts_per_page’ => -1 ) ); function get_the_title( $post = 0 ) { $post … Read more

Adding tag slug to post permalink

You need to add a new tag (e.g. %tag%) that you can use in post links. One possibility is to use the add_rewrite_tag() function. Then use the post_link filter to replace the %tag% in the link with the appropriate value. Finally, change the post link structure in the settings. Settings -> Permalinks -> Custom Structure: … Read more

How can I strip a single tag from an email post

The following regex should do the trick to select all instances of the videopack shortcode, including contents: \[videopack.*?\[\/videopack\] $post_description = preg_replace( ‘\[videopack.*?\[\/videopack\]’, ”, $post->post_content ); https://www.php.net/manual/en/function.preg-replace.php https://regexr.com/

Get post list in same category

Creating a system to load the next post within the same category can indeed be achieved with modifications to your existing code. Here’s how I think you should modify it so it works: // Assuming you have the current post ID stored in $current_post_id $current_post_id = get_the_ID(); // Retrieve the current post ID $current_post_categories = … Read more