Support

Account

Home Forums Pre-purchase Questions ACF in another Plugin

Solving

ACF in another Plugin

  • Can I add a field to another plugin? The field appears in the Administration of the post, but must be printed in this part of the plugin:

    // Closing post excerpt container.
    $postExcerptHTML .= ‘</div><div class=”subhome”>’ . the_field(‘sub_title’) . ‘</div><div class=”srp_fb”><div id=”fb-root”></div><script src=”http://connect.facebook.net/en_US/all.js#appId=MYID&xfbml=1″></script><fb:like href=”‘ . get_permalink($post->ID) . ‘” send=”false” layout=”button_count” width=”550″ show_faces=”false” font=””></fb:like></div>’;

    But doesn’t work!

    I use this plugin:
    http://codecanyon.net/item/special-recent-posts-pro-edition/552356

    and I am ready, too, to buy the PRO version of ACF if you help me.

    Field ACF should appear here (in the home): http://www.news-24h.it

    EXAMPLE: EXAMPLE

  • Hi @marty84

    Yes you can use it within another plugin. If you’re looking to sell/distribute that plugin please have a look at: http://www.advancedcustomfields.com/resources/including-acf-in-a-plugin-theme/

    As for your code try changing the_field to get_field. You’re attempting to save the value in a variable and thus should use get_field since that will return the value rather than the_field that echoes the value.

    As a sidenote please try to add all code snippets inside code tags ๐Ÿ™‚ You can see the code tag button in the toolbar above the textinput field.

  • Oh sorry for tag code

    But I put get_field ('sub_title') and the same does not work.

    Reporting the code:

    $postExcerptHTML .= '</div><div class="subhome">' . get_field('sub_title') . '</div><div class="srp_fb"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=MyID&xfbml=1"></script><fb:like href="' . get_permalink($post->ID) . '" send="false" layout="button_count" width="550" show_faces="false" font=""></fb:like></div>';

  • This reply has been marked as private.
  • Hi @marty84

    Your screenshots doesn’t really help me much ๐Ÿ™‚

    I guess you can try using WP core functionality instead. If it still does not work it’s not an issue with ACF but rather with the plugin you use for recent posts.

    
    <?php
    global $post;
    $postExcerptHTML .= '</div><div class="subhome">' . get_post_meta($post->ID, 'sub_title', true) . '</div><div class="srp_fb"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=MyID&xfbml=1"></script><fb:like href="' . get_permalink($post->ID) . '" send="false" layout="button_count" width="550" show_faces="false" font=""></fb:like></div>';
    	
    ?>
    
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.