WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] c2c_get_custom to change layout? (3 posts)

  1. Rokuzen
    Member
    Posted 8 years ago #

    I'm trying to get the get_custom plugin to trigger a change in layout (adding a right column) when the key "rightside" is entered (the value to be shown in said column).

    Rightnow here is how i have it

    if (c2c_get_custom('rightside')) {
    echo "<div id="contentColumnContainer">";
    }
    else {
    echo "<div id="contentColumnContainer2">";

    Contentcolumncontainer providing the space for the right columm, contentColumnContainer2 allowing the content area to span.

    Obviously its not working and obviously I'm still new to php. what do I need to addto get the if statement to trigger when there's rightside as a key?

    Note, the content of the value field does show up (albeit off the screen).

    Thats being called by
    if (c2c_get_custom('rightside')) {
    echo "<div id=\"rightColumn\"><div class=\"inside\">";
    foreach ($posts as $post) : start_wp();
    echo c2c_get_custom('rightside');
    endforeach;
    echo "</div><hr class=\"hide\">
    </div>";
    }
    else {
    }'

    for an example of whats (not) going on
    newworldotter.com/about has 'rightside'
    newworldotter.com/about/rokuzen does not and should span the content area (i have it set up so theres always space for the right column, till this is fixed)

    Hope i explained it ok

    thanks in advance,
    Ryan

  2. mylagoon
    Member
    Posted 8 years ago #

    <?php if ( (c2c_get_custom('rightside')) ) { ?>
    <div id="contentColumnContainer">
    <?php } else { ?>
    <div id="contentColumnContainer2">
    <?php } ?>

    That should work. Basically what it's saying is that if the Key 'rightside' exists (regardless of it's value) then do div 1, if it doesn't exist, do div 2.

    Note, this has to be executed inside the loop (from memory), but if that's going to be a problem I can find a few work arounds.

    Post back if it doesn't work.

  3. Rokuzen
    Member
    Posted 8 years ago #

    Holy cats! Your solution worked. I added it into another loop and bingo.

    Thanks,
    Ryan

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.