Skip to content

Instantly share code, notes, and snippets.

Avatar

Oren Shamai orenshamai

  • spiral solutions
  • MIsgav
View GitHub Profile
@orenshamai
orenshamai / Display post custom field example
Created Apr 30, 2015
Display post custom field example
View Display post custom field example
<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'title-2', true);
wp_reset_query();
?>
View WP show post shortcode function
function dispos_func( $atts ) {
$atts = shortcode_atts(
array(
'post_id' => 'no foo',
), $atts, 'DisplayPost' );
$post_id = $atts['post_id'];
return get_post_field('post_content', $post_id);
}
add_shortcode( 'DisplayPost', 'dispos_func' );
You can’t perform that action at this time.