Adding something to the_content

You mostly got everything right. But the code you posted also gave an error caused by an ’ char in your code. add_filter (‘the_content’, ‘references’); function references( $content ) { // only run the code on singular views of the post type “my_custom_post_type” if( is_singular(‘my_custom_post_type’) ) { // insert your custom post type here // … Read more

Displaying a Custom post type per day

The problem is the loop: foreach ( $hadices as $post ) : setup_postdata( $post ); if ( have_posts()) : while (have_posts()) : the_post(); setup_postdata( $post ); ?> <h2><a href=”https://wordpress.stackexchange.com/questions/302904/<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <?php the_content(); ?> <?php endwhile; endif; endforeach; wp_reset_postdata(); If we fix the indenting and format it properly we get: foreach ( $hadices … Read more

Custom Taxonomy Category link

You have to add a taxonomy category for your new custom post type such as function mvli_customtype_category() { register_taxonomy( ‘customtype-category’, ‘customtype’, array( ‘label’ => __( ‘Category’ ), ‘rewrite’ => array( ‘slug’ => ‘customtype-category’ ), ‘hierarchical’ => true, ) ); } add_action( ‘init’, ‘mvli_customtype_category’ ); And then you can easily open the link like this website.com/customtype-category/ … Read more

Custom Rewrite Rule for Custom Post Type with URL Param

SOLUTION: I am answering my own question here since no responses were given and I presume this might be helpful to someone and in the mean while I found a solution.. I had to use the second version of ‘add_rewrite_rule’: add_rewrite_rule( ‘^products/directory/?([^/]*)/?’, ‘index.php?post_type=acme_product&c=$matches[1]’, ‘top’ ); I needed to register a query var,, since external query … Read more