WordPress.org

Forums

Advanced Custom Fields - Widget Relationship Field add-on
[resolved] Need help to use this plugin (4 posts)

  1. keiju
    Member
    Posted 2 years ago #

    Hi
    I´m trying to make this plugin work but I´m not sure how to edit the sidebar.php.

    Mine is:

    <?php if ( is_active_sidebar( 'sidebar-1' ) ){ ?>
    	<div id="sidebar">
    		<?php dynamic_sidebar( 'sidebar-1' ); ?>
    	</div> <!-- end #sidebar -->
    <?php } ?>

    where do I put the

    if ( ! acf_Widget::dynamic_widgets( 'Side Bar' ) ) {
    
       //fallback to default function if you like
       dynamic_sidebar( 'Side Bar' );
    
    }

    THANKS!!!

    http://wordpress.org/extend/plugins/advanced-custom-fields-widget-relationship-field-add-on/

  2. djbokka
    Member
    Plugin Author

    Posted 2 years ago #

    Give this a shot:

    <?php if ( is_active_sidebar( 'sidebar-1' ) ){ ?>
    	<div id="sidebar">
    		<?php if ( ! acf_Widget::dynamic_widgets( 'sidebar-1' ) ) { ?>
                         <?php dynamic_sidebar( 'sidebar-1' ); ?>
                    <?php } ?>
    	</div> <!-- end #sidebar -->
    <?php } ?>

    That will fallback to the default sidebar functionality if 1) the class isn't found or 2) there are no filtered widgets returned from the function.

  3. keiju
    Member
    Posted 2 years ago #

    That works so perfectly!
    Thank you, man.
    Seriously.

    The old posts keep their old widgets and the new ones I can configure as desired.

    I must say I´ve tried 3 plug-ins before this to get this done and only this works as i wanted.

    Thank you again.

  4. djbokka
    Member
    Plugin Author

    Posted 2 years ago #

    Excellent. I'm glad it works for you. We have quite a few sites running it and have been pretty happy with the results.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields - Widget Relationship Field add-on
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.