Echo custom admin field into a is_single()

$postids = get_option(‘codeable_posts_field’); This will give you a string of comma separated post ids (according to your code, and if the user follows the instructions). array( $postids ) will turn it into an array with that string as the only element. That won’t work with is_single(), obviously, because is_single doesn’t do any further splitting. Here’s … Read more

How to submit form data in the same page in WordPress without reloading the page?

Your jQuery event is bound to elements with the class submit, but your submit button in the form doesn’t have that class. Either add that class to the submit button, or just target the form itself. Simply change $(“.button”).click(function() { to $(“#modalForm”).submit(function() { This will fire when the form is submitted, whether the user clicks … Read more

custom field – changing an element or background of id div – different versions not working

In most themes anything added via the wp_head hook should appear after (and override) enqueued CSS. So you could add an action to the themes functions.php and use get_queried_object_id() for the post ID. function my_dynamic_css() { $custombg = get_post_meta( get_queried_object_id(), ‘custombg’, true ); if (! empty($custombg)) { ?><style>#Box2 {background: <?php echo $custombg; ?> }</style> <?php … Read more