Support » Themes and Templates » Not show entire posts in Customised Page

  • noyu


    1. I’m using Exec-PHP plugin to allow using php in my Pages.
    2. I save my Pages codes in an external php file and in my ‘edit Page’, I link it like so:
    <? require_once(ABSPATH. '/wp-content/custom-php/my_custom_page.php'); ?>
    as suggested by someone online.
    3. I’m using custom fields to retrieve and display only some info from 3 specific posts (i.e thumbnail and a short description).

    I am able to display my custom fields. However, I also end up showing the 3 posts entirely at the end of my custom fields.
    How do I prevent wordpress from showing the entire post automatically. I am not very good with php, and work through trial and error, but got stuck at this for too long already.

    If anyone can give me some insight, it would be much appreciated.


    <?php get_header(); ?>
    <?php include("menu.php"); ?>
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<h1><?php the_title(); ?></h1>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    	<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>


    <?php query_posts(array('post__in' => array(14,17,20))); ?>
    	<?php while (have_posts()) : the_post();
    		global $post;
    		$fdesc = get_post_meta($post->ID, "desc", TRUE); /* define the custom field with key = desc */
    	<div class="" id="post-<?php the_ID(); ?>">
    		<p><?php echo $fdesc; ?>
    <?php endwhile; ?>

    One interesting thing is, I tried this code in page.php in one of my theme

    <?php if (have_posts()): ?>
    	<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    <?php endif; ?>

    and that seemed to solve the problem, but when i changed to my new theme, this code shows a blank page (i.e not able to direct to my custom page).

Viewing 1 replies (of 1 total)
  • noyu



    I have not found the solution but have an alternative.

    To create customised ‘Pages’ in wordpress, simply use put all your codes into a php file and make it a customised page template (just by adding template comment at the top.

    Then in WP control panel,
    Edit Page> Attribute > Template > choose your customised page template

    This way, you don’t even need to use Exec-php to execute php codes in posts. Just leave the content blank and put all your content in the customised page template.

    hope this helps someone out there. cheers.

    p.s, i am still curious how to solve my previous problem. if anyone knows, do leave a comment. thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Not show entire posts in Customised Page’ is closed to new replies.