WordPress.org

Ready to get started?Download WordPress

Forums

Pagely MultiEdit
[resolved] MultiEdit Regions and Conditionals (3 posts)

  1. Andrew Miguelez
    Member
    Posted 1 year ago #

    I would like to conditionally include code in my custom pages, dependent on whether or not there is content in a certain region. How can I do this?

    Pseudo:

    <?php if (region) { ?>
      <div class="region">
        <h2>heading</h2>
        <?php multieditDisplay('region'); ?>
      </div>
    <?php } ?>

    http://wordpress.org/extend/plugins/pagely-multiedit/

  2. Acts7
    Member
    Posted 1 year ago #

    I see its been 3 months. Hopefully this is still of help to you or others?

    // don't forget to add the suffix class "multiedit_" which is automatically appended to all of your multiedit fields.
    //you can find the full name, by viewing your post , going to the custom-fields section and clicking "show/hide multiedit fields"
    In your case you should see "multiedit_region"

    // if you are checking multiple fields in unique spots on your template, be sure to give each a unique variable name.
    //this could be done easier with a function where you pass the key name but for simplicity this works
    
    // define the key you want to find
    $key4 = 'multiedit_region';
    
    // use this WP built in function to grab the meta key
    $themeta4 = get_post_meta($post->ID, $key4, TRUE);
    
    // now lets see if anything was returned in that meta key value
    if($themeta4 != '') {
    
    // if found , display the multiedit field and its surrounding html code
      <div class="region">
        <h2>heading</h2>
        <?php multieditDisplay('region'); ?>
      </div>
    
    }
  3. Andrew Miguelez
    Member
    Posted 8 months ago #

    The project I needed this solution for is long finished and I forget how I went about handling it. But your answer is sufficient to resolve my topic. I hope this is a help to others searching for a way to do the same thing I was.

    Thank you, @Acts7.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic