• Resolved RUBYHAUS

    (@rubyhaus)


    Hey all,

    I’m pulling a page into my custom home page. I know how to do this using categories as I do using pages. However what I’m lacking what should be some basic PHP principals of syntax.

    Here I’m pulling my Page of info into my home page using:

    <div class="test_page">
    <?php
      $page_id = 41; //ID of page from your WP admin panel
      $page_data = get_page( $page_id ); 
    
      echo $page_data->post_title; // Show page title
      echo $page_data->post_content; // Show page content
    ?>
    </div>

    It works perfect!

    What I can’t seem to figure out reading at PHP.net is how to properly nest HTML within the Echo statement ie:

    echo $page_data->post_title('<h1> the_title();</h1>');

    I would like to place some H1 tags around the title portion of this.

    Any insight would be much appreciated.

    ~ Jonny

Viewing 1 replies (of 1 total)
  • Thread Starter RUBYHAUS

    (@rubyhaus)

    Never mind.

    I figured it out. Those interested in pulling another pages content into another page or multiple pages here is how:

    <div class="news_events">
    	<?php
      $page_id = 41; //ID of page from your WP admin panel
      $page_data = get_page( $page_id ); 
    
    	echo "<h1>" . $page_data->post_title . "</h1>";// Show page title
      echo $page_data->post_content; // Show page content
      ?>
      <br /><br />
      <a href="/wordpress/gccvb-calendar-of-events">>>more events...</a>
          </div>

    basically copy this div and place it in each area on the page such as the home page. Sync up each div’s PHP id number to the corresponding page you wish to pull into that area of your home page and blammo. Your rocking and rolling. Pulling pages into pages.

    Sincerely,
    ~ Jonny of Rubyhaus

Viewing 1 replies (of 1 total)
  • The topic ‘Pulling Pages into Pages nesting HTML within echo statements’ is closed to new replies.