Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Sam_Tutt

    (@sam_tutt)

    Dont worry i solved the problem

    In the second lot of code i had query_post instead of get post

    My code now looks like this:

    <?php
    $current_author = get_query_var('author');
    $author_posts=  get_posts( 'author=2&posts_per_page=5' );
    if($author_posts){
    echo '<ul class="author-articles">';
    foreach ($author_posts as $author_post)  {
     echo '<li><a href="'.get_permalink($author_post->ID).'">'.$author_post->post_title . mysql2date('j M Y', $post->post_date);'</a>  </li>';
    }
    echo '</ul>';
    }
    ?>
    
    <div>
    Show More
    </div>
    
    <div>
    <?php
    $current_author = get_query_var('author');
    $author_posts=  get_posts('author=2&posts=10&offset=6');
    if($author_posts){
    echo '<ul class="author-articles">';
    foreach ($author_posts as $author_post)  {
     echo '<li><a href="'.get_permalink($author_post->ID).'">'.$author_post->post_title . mysql2date('j M Y', $post->post_date);'</a>  </li>';
    }
    echo '</ul>';
    }
    ?>

    I have got it to work where you click the show more button and shows the other 5 posts!

    Thanks for all of your help!

    Thread Starter Sam_Tutt

    (@sam_tutt)

    Hi tsure,

    Thanks for the help but doesn’t look like what I need

    Thread Starter Sam_Tutt

    (@sam_tutt)

    I changed to a WP_query and nothing has changed, the 404 error still occurs.

    I also have gone through each plugin and deactivated them one by one to see if its a plugin thats causing it.

    Is there anything else i can do to try and fix it?

    Thread Starter Sam_Tutt

    (@sam_tutt)

    Yeah, I have moved them around and have also tried different loops as well and nothing seems to make a difference.

    Is it worth me looking at hanging the loop to wp_query?

    Thread Starter Sam_Tutt

    (@sam_tutt)

    We have separate category php files for each blog category so we have category-technical-blog.php, category-news.php etc. so category-technical-blog.php is used just for the /technical-blog page

    Its all a bit confusing, we didn’t start out with a full php structure so stuff has been added and changed overtime where we have been changing the site

    Thread Starter Sam_Tutt

    (@sam_tutt)

    Hi,

    Our code for our blog is below:

    <?php get_header(); ?>
    <?php
    if ( in_category('technical-blog')) : ?>
    <div id="subpage-header-container">
    	<div id="subpage-header-content">
    	Reliable hardware &nbsp;-&nbsp; Trained Staff<br /><br />
    	<h1><strong>Technical Blog</strong></h1>
    	<img alt="Horizontal White Line" src="/wp-content/themes/vooservers/img/subpage-hr1.png" /><br /><br /><br />
    <div class="breadcrumbs" xmlns:v="https://rdf.data-vocabulary.org/#">
        <?php if(function_exists('bcn_display'))
        {
            bcn_display();
        }?>
    </div>
    	<span style="text-transform:none;display:none;"><em>You are here:&nbsp;&nbsp;Support / Technical Blog</em></span>
    	</div>
    </div>
    <div id="blogparent" >
    <div itemscope itemtype="https://schema.org/Article" id="blogcontainer" style="min-height: 701px !important;">
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <span style="font-size: 20px;">
    
        <div style="height: 80px; margin-bottom:20px; ">
        <a href="<?php $author_id=$post->post_author; $user_info = get_userdata($author_id); echo $user_info->user_url; ?>"><?php the_author_image($author_id = null); ?></a>
        <div style="padding-top:30px;">
        &nbsp;&nbsp;&nbsp;By <a href="<?php $author_id=$post->post_author; $user_info = get_userdata($author_id); echo $user_info->user_url; ?>"><span itemprop="author" itemscope itemtype="https://schema.org/Person">
        <span itemprop="name"><?php the_author(); ?></span></span></a></div>
        <div id="date-published">
        <p style="font-family: verdana, geneva; font-size: 16px;color: #404f5a;">
          <strong>
          <span itemprop="datePublished" content="<?php the_date('d-m-Y') ?>"><?php the_time('F jS, Y') ?></span><br />
          </strong>
        </p>
        </div>
        </div>
    
        <div style="margin-bottom:20px;">
          <strong>
        <a style="font-family: verdana, geneva;color: #404f5a;text-decoration: none;" href="<?php the_permalink() ?>" rel="bookmark"><span itemprop="name"><?php the_title(); ?></span></a>
          </strong>
        </span>
        </div>        <span itemprop="articleBody"><p>
    	  <?php the_advanced_excerpt(); ?>
            </p></span>
              <br>
                <hr class="blog-break">
                    <?php endwhile; else: ?>
                    <p>
                      <?php _e('Sorry, no posts matched your criteria.'); ?>
                    </p>
                    <?php endif; ?>
                              <?php elseif (have_posts()) : while (have_posts()) : the_post(); ?>
                              <?php the_content(); ?>
                              <?php endwhile; else: ?>
                              <p>
                                <?php _e('Sorry, no posts matched your criteria.'); ?>
                              </p>
                              <?php endif; ?>
    <div id="newsnavbutton-container">
    <?php posts_nav_link(' · ','<div id="newsnavbutton"><p>Newer Posts</p></div>','<div id="newsnavbutton"><p>Older Posts</p></div>'); ?>
    </div>

    Its happening on all category pages, they all use similar php code to run.

    Its probably worth me saying that we recently updated to 4.4.2 and the probably came about after the update

    Thread Starter Sam_Tutt

    (@sam_tutt)

    Thank you both for the help!

    Thread Starter Sam_Tutt

    (@sam_tutt)

    The theme is completely custom, built from scratch

Viewing 8 replies - 1 through 8 (of 8 total)