How Can I Display Genesis-Boxes using Custom Fields?

Community Forums Forums Design Tips and Tricks How Can I Display Genesis-Boxes using Custom Fields?

This topic is: resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Jen Baumann 1 year, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6387

    netbloger
    Participant

    Hi, I run my website on Genesis Framework. I read tutorial about displaying genesis box here:
    http://www.briangardner.com/genesis-box/

    I did everything correctly.

    But now I want to know how can I display genesis-box using custom fields?

    Because I want to add more boxes on my genesis site like:

    listbuilding-box
    hosting-box
    membership-box
    etc.

    My question is How can I display genesis-box or other boxes depending on custom filed?

    Sample Scenario:

    Genesis box displayed on post only if custom field ‘genesis‘ has value: ‘true

    Or something like that.

    Any kind of help would be appreciated.
    Thanks,
    Simon

    #6495

    Jen Baumann
    Keymaster
    Post count: 444

    This is totally untested code. I just did it real quick to give you an idea of what you might do.

    /** Add Genesis Box on Single Posts */
    add_action( 'genesis_after_post_content', 'include_genesis_box', 11 );
    function include_genesis_box() {
    if ( is_single() )
    $genesis_box = genesis_get_custom_field( 'box_select' );
    if ( $genesis_box == 'listbuilding-box') {
    require( CHILD_DIR.'/listbuilding-box.php' );
    }
    if ( $genesis_box == 'hosting-box') {
    require( CHILD_DIR.'/hosting-box.php' );
    }
    }


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

    #6625

    netbloger
    Participant

    It works like a charm!

    Thanks ;)

    #6842

    Jen Baumann
    Keymaster
    Post count: 444

    Phew! Great! You’re welcome!


    If you need technical support for your theme please file a ticket.

    The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘How Can I Display Genesis-Boxes using Custom Fields?’ is closed to new replies.