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

No result update a custom field using wp_schedule_event

It think that your problem is the you are passing the post ID as url parameter to facebook API: $url = get_the_ID(); Also, as get_posts return an array of post objects, you could use this code: $posts = get_posts(array(‘numberposts’ => -1) ); foreach($posts as $post) { $url = get_permalink( $post->ID ); $fbcount = json_decode( file_get_contents( … Read more

How to write specific HTML code with a specific custom field? [closed]

Try this : // get_the_ID() will work if you’re running within The Loop. $fieldA = get_post_meta( get_the_ID(), ‘name_of_fieldA’, true ); $fieldB = get_post_meta( get_the_ID(), ‘name_of_fieldB’, true ); if( $fieldA ) { echo “<a href=””.$fieldA.”” target=”_blank” class=”btn btn-primary fb-event”></a>”; } if( $fieldB ) { echo “<a href=””.$fieldB.”” target=”_blank” class=”btn btn-primary ra-event”></a>”; }

Let author add field to metabox by pressing a button

I packed everything together. Consider using wp_enqueue_script() to use the script. With this code, you will save all URLs as an array. See how I use get_post_meta() to retrieve the saved URLs. function save_custom_metabox($post_id){ if(!isset($_POST[‘source_post_metabox_nonce’])) : return; endif; if(!wp_verify_nonce( $_POST[‘source_post_metabox_nonce’], ‘source_post_metabox’)) : return; endif; if(defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) : return; endif; if(!current_user_can(‘edit_post’, $post_id)) return; if ( … Read more