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 »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> <?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; ?> </div> <?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 »</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).