Create Shortcode shows only posts with custom_field meta

You need your shortcode to accept attributes. A shortcode with attributes would look like: [publication year=”2017″] Then in your add_shortcode callback function you receive attributes in the first parameter of the function: function wpse_279094_publication_shortcode( $atts ) { echo $atts[‘year’]; } add_shortcode( ‘publication’, ‘wpse_279094_shortcode’ ); You want to be able to account for a user not … Read more

Change Order of Sections Using Custom Fields

Have 5 custom fields: the first 4 are your sections and the last would be your order identifier. CASE 1 If you want to have the order simply revsered have the last field be a dropdown with “normal” or “reversed”. (You could even say “random”… the world is your oyster) $s1 = ‘<section id=”1″>$customfield1</section>’; $s2 … Read more

Custom fields with wordpress

You can try the date() function: $date = get_post_meta($post->ID, ‘event_start_date’, true); $day = date(‘d’, strtotime($date)); //01-31 Another way will be DateTime: $date = get_post_meta($post->ID, ‘event_start_date’, true); $date = DateTime::createFromFormat(‘Y-m-d’, $date); $day = $date->format(‘d’);