Displaying post content based on id variable – WordPress

firstly thanks if you’ve taken the time to try and help out here!

I’ve recently bought this plugin:
Pro Panel WordPress Themes Options Panel

Read More

It’s a brilliant item, however one of the functions is to ‘select page from a drop down menu’. I for some reason can only echo the page slug: what-we-do

I want to echo the_title and the_content.

<?php     
    $blockwho = get_option('good_blockwho');
    echo $blockwho;
?>

The above code outputs the slug (its the code given to me in the documentation).

And the below code is what’s in my functions

$options[] = array( "name" => __('Who We Are Block','framework_localize'),
    "desc" => __('My Description.','framework_localize'),
    "id" => $shortname."_blockwho",
    "std" => "1",
    "type" => "select",
    "options" => $tt_pages);

Apologies if this is a newbie question, and thanks again for taking the time to read/help!

Related posts

Leave a Reply

2 comments

  1. Ok so with a little help from a friend i’ve got the code working at long last! For any one who contacted me and tried to help be it in other questions or here, thank you!

    <?php
    $blockwho = get_option('good_blockwho');
    $homeblockwho = get_pages ('post_name='.$blockwho);
    
    foreach ($homeblockwho as $hbw) {   
      $content = $hbw->post_content;
      $content=do_shortcode($content);
      if ($content!='') echo "<h2><span>".$hbw->post_title."</h2></span>";
      apply_filters('the_content', $content);
    
      echo "".$content."";
    }
    ?>
    
  2. Hi guys after a couple days of testing, reading up on the WordPress Codex i’ve finally been able to achieve half of what i wanted. The following code posts the content, with shortcode enabled.

     <?php
      $blockwho = get_option('good_blockwho');
      $homeblockwho = get_pages ('post_name='.$blockwho); ?>
    
    
    <?php foreach ($homeblockwho as $hbw) {        
        $content = $hbw->post_content;
        apply_filters('the_content', $content);
    
        echo "".do_shortcode($content)."";
    }?>
    

    Hope this code is useful, ill post an update when i am able to also post the page title.