• Resolved jrodgers

    (@jrodgers)


    I have a wordpress set up so that my home page is static and all posts except cat1 posts are shown on page1, cat1 posts are shown on page16 but when i use the <!–more–> tag on cat1 posts it is ignored when displayed on the custom page, how can i correct this?

    tia

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter jrodgers

    (@jrodgers)

    adding
    $more=0; before the loop corrects this

    jrodgers, I’ve tried adding $more=0 before the loop, but without any success. Are you using get_posts()?

    I’m using page.php. The page has a custom field that sets a related category. I’m grabbing posts for that category.
    It’s working fine except for the more quicktag. Any suggestions?

    <?php if (isset ($relatedcat)) { // if page has related category
      $more = 0;
      global $post; $myposts = get_posts('numberposts=99&category='.$relatedcat.'&order=ASC');
      if($myposts) {
      foreach($myposts as $post) {
      setup_postdata($post);
    	?>

    full code: https://wordpress.pastebin.ca/1022004.

    Thread Starter jrodgers

    (@jrodgers)

    my code looks like this

    <?php
    query_posts(‘page_id=’.$_GET[‘page_id’]);
    $more = 0;
    ?>

    I am still have trouble getting the more tag to work. I’ve tried setting the more variable to 0 and to 1. Neither works on a custom page that uses a plug in to collect various posts (see this page).

    Here’s the whole code for the page (let’s hope this posts):

    <?php /* Template Name: Page allowing More Tag */ ?>
    <?php get_header(); ?>
    <div id="content">
    <!-- This is using page-more.php -->
    <?php if (have_posts()) :  while (have_posts()) : the_post(); ?>
      <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
      <?php the_content(__('... read more here')); ?>
      <?php wp_link_pages(); ?>
      <?php edit_post_link(__('Edit'), '<p>', '</p>'); ?>
    <?php endwhile; endif; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thanks!

    Thread Starter jrodgers

    (@jrodgers)

    try this

    <?php /* Template Name: Page allowing More Tag */ ?>
    <?php get_header(); ?>
    <div id=”content”>
    <!– This is using page-more.php –>
    <?php
    query_posts();
    $more = 0;
    ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h2 id=”post-<?php the_ID(); ?>”><?php the_title(); ?></h2>
    <?php the_content(__(‘… read more here’)); ?>
    <?php wp_link_pages(); ?>
    <?php edit_post_link(__(‘Edit’), ‘<p>’, ‘</p>’); ?>
    <?php endwhile; endif; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    jrodgers, thanks so much for your suggestion.

    It seems the more quicktag does not work with get_posts() even when using $more = 0.

    It does work with query_posts() with $more = 0 even if you use page.php.

    A note for people switching functions. Use category= with get_posts(). Use cat= with query_posts().

    Next challenge: get tags working on my related posts displayed below my page’s content.

    Here’s my query for posterity:

    <?php if (isset ($relatedcat)) { // if page has related category
     $query= 'numberposts=99&cat='. $relatedcat.'&orderby=date&order=ASC';
     query_posts($query); // run the query
     global $more; $more = 0;
     while (have_posts()) : the_post();
     setup_postdata($post);
    ?>
    <div class="post" >

    $more = 0 did it for me. Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘more ignored in custom posts page’ is closed to new replies.