• Resolved lieska

    (@lieska)


    I try to show the content of a certain custom type post, only this one post.

    There are lots of custom fields in this post type. At the moment I’m not successful, neither the bodytext nor the custom fields show. This is my shortcode at the moment:

    [netsposts post_type=’my_custom_post_type’ include_post=’3409′ full_text=’true’]

    Am I doing something wrong or is it impossible to use this plugin as I’m trying to?

    Thank you in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author johnzenausa

    (@johnzenausa)

    I’m working on an upgrade right now to include custom fields.

    Plugin Author johnzenausa

    (@johnzenausa)

    @lieska

    I have enabled to return strings from the ACF plugin. That is it returns the strings only so it will only work well with custom fields that return text or numbers. If it’s anything complicated you’ll just a long string of gibberish (which is the actual code converted to a string output). So if you’d like to include dates, urls, certain text fields it will work. The argument is include_post_meta='custom_field_1,custom_field_2,custom_field_3 etc…

    It is just way too much work to be compatible with all custom field types. Maybe in the future in a premium version of this plugin 🙂

    Plugin Author johnzenausa

    (@johnzenausa)

    The custom fields generally get surrounded by <span></span> tags. So if you’d like them to be something different and include a class maybe you can add this to your functions.php file, custom plugin or use as plugin to insert the code. Here is an example:

    add_filter('netsposts_get_acf_html', 'print_acf_html', 10, 2);
    
    function print_acf_html($fields, $post){
    $html = '';
    foreach($fields as $field){
    $html .= '<div>' . $field['label'] . ': ' . $field['value'] . '</div>';
    } 
    return $html;
    }
    
    or even
    
    function print_acf_html($fields, $post){
    $html = '<div>';
    $html = '<p>';
    $html .= $fields['some_field']['label'];
    $html .= '</p>';
    $html = '<p>';
    $html .= $fields['some_field']['value'];
    $html .= '</p>';
    $html .= '</div>';
    return $html;
    }

    some_field just gets replaced with the name of the custom field, label gets replaced with the label, value with the value, etc…

    Plugin Author johnzenausa

    (@johnzenausa)

    @lieska

    I changed the shortcode argument from:
    include_post_meta=
    to
    include_acf_field=

    Thread Starter lieska

    (@lieska)

    Great, thank you for these, I will try them in some point! (I ended up in this project using another plugin.)

    Plugin Author johnzenausa

    (@johnzenausa)

    which plugin?

    Thread Starter lieska

    (@lieska)

    Broadcast. It is of course different copyiing the post instead of just showing the original.

    But this seems to be really difficult issue in WordPress MultiSite installation: how to share a post to multiple sites (without having to copy it).

    If you can figure out a real way to have only one original post (cusatom with custom fields) without having to duplicate the post and which is delivered to different sites – it would be a treasure.

    Plugin Author johnzenausa

    (@johnzenausa)

    So let me see if I completely understand the question. You want to be able to post any post or page from one blog on to another as if it was created on the other site without having to copy it?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Single view, custom post type with custom fields’ is closed to new replies.