• Resolved ABoooo

    (@aboooo)


    Hi,

    I’ve created a custom theme and I’m using a template for a blog page. In my template I have a code that calls specific posts according to category. So far so good, problem is when post contains “read more”. Link is active but when I click on it I only get an empty page instead of an whole article.

    This is my code:

    <?php
    		$args = array(
    				   'category_name' => 'blog',
    				   'post_type' => 'post',
    				   'posts_per_page' => 10,
    				   );
    
    		query_posts($args);
    
    		  while (have_posts()) : the_post();?>
            	  <?php global $more; $more = 0; ?>
     			  <?php echo '<p class="date"><i class="fa fa-calendar"></i> ';
    					echo get_the_date();
    					echo '</p>';
    			   		echo '<h2>';
    					echo '<a class="permaLink" href="';
    					echo the_permalink();
    					echo'" title="';
    					echo the_title_attribute();
    					echo'">';
    					echo the_title();
    					echo '</a>';
    					echo '</h2>';
    					echo '<p class="posts">';
    				  	echo get_the_content('<br/><br/>Read more...');
    				  	echo '</p>';
    
    					echo '<hr/>'; ?>
    		<?php endwhile; ?>

    Any help would be appreciated. Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • do you have DEBUG enabled to check warnings or error messages?
    https://codex.www.ads-software.com/Debugging_in_WordPress

    what template does the posted code belong to?

    what is the code of single.php if it exists, or of index.php?

    Thread Starter ABoooo

    (@aboooo)

    thanks alchymyth,

    – debuging ist “true” but I do not get any error messeges on page or in console
    – custom page template

    <?php
    /*
    Template Name: blog
    */
    ?>

    – I do not have single.php file, the code for index.php is to long to post it here, it calls all posts except those that are in blog category

    P.S. on front page (index.php) read more link works OK

    double check the permalink settings; possibly revert to default permalinks, save, then re-set your custom permalinks if you had any.

    only get an empty page instead of an whole article.

    totally white and empty or just the post missing?

    can you provide a link to your site to illustrate the problem?

    Thread Starter ABoooo

    (@aboooo)

    thanks for a tip, permalinks looks ok

    not totally empty just, post missing – design, menu, etc… are OK

    unfortunately cannot, the site is not online yet

    My guess is that it opens a new page in index.php instead of in the same template, would something like that be possible?

    Sorry if my questions doesn’t make sense, been more a designer as a developer.

    thanks for your help!

    Thread Starter ABoooo

    (@aboooo)

    I’ve just tried with a single.php and it works! It was a problem because single.php was missing. Thanks again for you help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘read more link / page’ is closed to new replies.