Hi there
I have tried to call a single custom post with this shortcode:
function cpt_content_func($atts){
ob_start();
$post = ”;
$content = ”;
extract( shortcode_atts( array(
‘slug’ => null,
), $atts ) );
$args = array(
‘name’ => $slug,
‘post_type’ => ‘rejser’,
‘numberposts’ => 1
);
$post = get_posts( $args );
if ( !empty( $post ) ) {
$content = apply_filters( ‘the_content’, get_post_field( ‘post_content’, $post[0]->ID ) );
}
return $content;
return ob_get_clean();
It retrieves the information from the original wysiwyg-field, every posts have.
It does not show the fields i have made with ACF.
I tried to include this line:
include_once(‘advanced-custom-fields/acf.php’);
Still no effect..
Do you know how to make the shortcode show all the custom fields? Is there a function to do just that, or maybe a plug-in, if my shortcode function is not possible to work with.
Thank you in advance!
Best Regards
Nikolaj