WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom block in header works on post page but not on "page" page (3 posts)

  1. David Borrink
    Member
    Posted 9 months ago #

    In developing a site, I successfully added a block of text in the header which calls up a post to present the client's name, phone and email. It worked fine on my MAMP setup. All Pages showed the custom block in the header.

    In setting the site up on my client's hosting, my custom block only shows up if I view the Post that contains this custom information. All the Pages do not show this block.

    The site is setup up with pretty permalinks on the client's hosting. My MAMP setup uses iD numbers. Aren't I able to use id numbers in my post callup even though the site uses pretty permalinks?

    Here is the link to the site in development.

    Here is the link to the post page that contains the text that shows up in the header. You should see this text in the header above.

    And here is the callup in my header.php file that calls up the post:

    <?php
    $captext_q = new WP_Query( 'p=1' );
    // The Loop
    if ( $captext_q->have_posts() ) :
      while ( $captext_q->have_posts() ) : $captext_q->the_post(); ?>
          <?php the_content(); ?>
      <?php endwhile;
    endif;
    wp_reset_postdata();
    ?>

    My post is the "Hello World" default post, edited, so it's ID 1.

    And ideas why my custom block isn't showing up on Pages? (And I'm prepare to have missed the obvious... :-) )

  2. Pioneer Valley Web Design
    Member
    Posted 9 months ago #

    Create a New post with diff ID and try.

  3. David Borrink
    Member
    Posted 8 months ago #

    That solved it. Apparently one cannot use the default post ID 1 for custom purposes. Thanks for the suggestion!

Reply

You must log in to post.

About this Topic