Adding Template Post Content

It’s possible you may have to define your own ACF Custom Field Type which holds your templates. And after a template is selected then you would programmatically copy the fields to a repeater. Awesome ACF has quite a few examples, WordPress has quite a few plugins and there is a User Submitted Add-Ons support forum.

Adding Custom CSS with PHP

I know this sounds like it’s a good idea, but anyone can simply just view the source of the page and take whatever they want from there. They can also simply just hit Ctrl+S on their keyboard and save that entire page to their hard drive. They could even screenshot the page and use OCR … Read more

How is WordPress changing the content markup?

WordPress runs a filter on the content to automatically add paragraphs: wpautop. You can remove the filter from all your post’s content if you like: remove_filter(‘the_content’,’wpautop’); Alternatively, you can check out the Disabler plugin which can do this for you. If you want to remove the filter from particular post(s) you can do: add_filter(‘the_content’,’maybe_remove_wpautop’,9); function … Read more

Display an image based on field value

How about this? <?php $meta = get_post_meta( get_the_ID(), ‘region’, true ); if ($meta == ‘NA’) { ?> <img src=”https://www.esrnetwork.com/wp-content/uploads/2016/12/NA.png” width=”25″ height=”25″/> <?php } elseif ($meta == ‘EU’) { ?> <img src=”https://www.esrnetwork.com/wp-content/uploads/2016/12/EU.png” width=”25″ height=”25″/> <?php } else { } ?>

Additional content every x comments

Here’s one approach using the following custom input arguments: wp_list_comments( [ ‘_inject_period’ => 5, ‘_inject_content’ => [ ‘AAA’, ‘BBB’, ‘CCC’ ], ] ); where we setup the inject period and define the content to inject. This could be supported by the following demo plugin that extends the \Walker_Comment class and enhances the start_el() method: <?php … Read more

the_content() Not Grabbing All Content

Try calling the_post() at the top of the file before calling functions like the_title() and the_content() If that doesn’t work, then most likely you have a function on the the_content filter that is causing this problem. Try disabling the plugins you have installed one by one to see if that fixes the problem

How To Render Shortcode In AJAX Response?

In general, sshortcodes are not a programming construct, they are content macros. As content macros, their viability in being used outside of their content context is limited. Simplistic shortcodes, like the gallery/audio/video (and I am not sure even about them) might “render” without context, but advanced ones will need a properly set loop, and calls … Read more