Split single-review.php to two parts

Yes, use an if statement, inside your post loop do something like this: while ( have_posts() { the_post(); $value = get_post_meta( $post->ID, ‘metakey’, true ); if ( $value == ‘a’ ) { get_template_part( ‘something’ ); } else { get_template_part( ‘somethingelse’); } } If I were to take your question more literally however, I might interpret … Read more

Shortcode to get featured image of specific id post

Using your example I’ve updated it to return instead of the title the image. function post_shortcode( $atts ) { extract( shortcode_atts( array( ‘id’ => ”, ), $atts ) ); if ( isset( $id ) ) { return ‘<a href=”‘ . get_permalink( $id ) . ‘”>’ . get_the_post_thumbnail( $id, ‘thumbnail’ ) . ‘</a>’; } } add_shortcode( … Read more

Insert function insde body tag

The answer is “it depends” as usual 🙂 You can do it with hooks and I would recommand action-hook in this case or you can do it on your own. In both cases : define your function in a plugin, functions.php could be fine but be sure your function is not critical and can be … Read more

How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields? [closed]

I voted to close your question, because it is pretty much a PHP problem, not a WordPress one and thus off topic on here. Nonetheless here comes some help. General information about Formatting Date and Time from the WordPress codex you might find helpful. Aside from that, on the PHP side of things, the date … Read more

Only echo Page Content (not page title & page content together)

You can make use of the_page_content() outside the loop to display only the content of the page where the_page_content() is supported by the following function function the_page_content() { global $post; $content=””; if ( is_page() ) { $content .= apply_filters( ‘the_content’, $post->post_content ); } echo $content; } Inside the loop you can just use the_content();