• Resolved kristenfisher427

    (@kristenfisher427)


    I have the following layout I want to achieve:

    <div class="container">
    
      <h1>HEADING</h1>
      <p>PARAGRAPH 1</p>
    
      (Custom widget area with three Bootstrap cards side-by-side...for the sake of space, I'm not including the code)
    
      <p>PARAGRAPH 2</p>
    
    </div>

    Ideally, I would like to hard-code the div and the h1 into the page.php template file, call a custom widget area in page.php (utilizing dynamic_sidebar()), and use the_content() in page.php to display paragraph 1 and 2 from the content entered in the WordPress Dashboard.

    Here is where I run into a problem. In page.php, I would have the following code (slightly simplified, but this is the gist of it):

    <div class="container">
    
    <h1>HEADING</h1>
    																									         																										
    <?php the_content(); ?>
    
    <?php dynamic_sidebar( 'card_widget_area' ); ?>	
    	
    </div>

    I want paragraph 1 to be before the sidebar and paragraph 2 to be after the sidebar, yet, when I utilize the_content(), I get both paragraphs before the sidebar. Similarly, if I were to call the_content() after the sidebar, both paragraphs would display instead of only the second paragraph as desired. Is there a way to display only one of the paragraphs at a time using the_content() template tag? And can you use the_content() template tag more than once in a single template file?

    Perhaps I am missing something or making things far more confusing than they need to be. Any help would be greatly appreciated!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Leo

    (@leohsiang)

    Hi there,

    Not sure if I fully understand but this sounds more like a WordPress general question than a theme-specific question.

    If you are looking for custom coding/general WP help then a forum like this should be helpful: https://wordpress.stackexchange.com/

    We can only support questions related to the free theme feature here.

    Let me know if I’m missing something here.

    Thread Starter kristenfisher427

    (@kristenfisher427)

    Hi Leo,

    My apologies – I didn’t realize this was the incorrect forum for such a question! Thank you for your assistance!

    Leo

    (@leohsiang)

    No problem ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Problems with the_content() template tag’ is closed to new replies.