I have a wordpress powered site, which uses a classified ads theme.
The blog page on my site is set to show videos. I would like the blog to show only one video per page.
If I change the posts per page settings in the wordpress admin, then that interferes with the classifieds theme. I need to change one of the php files.
Here is the file that distinguishes the blog from the classifieds in the theme.
<?php get_header(); ?>
<!-- CONTENT -->
<div class="content">
<div class="content_botbg">
<div class="content_res">
<div id="breadcrumb">
<?php if(function_exists('cp_breadcrumb')) cp_breadcrumb(); ?>
</div>
<div class="content_left">
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post() ?>
<?php $category = get_the_category(); // To show only 1 Category ?>
<div class="shadowblock_out">
<div class="shadowblock">
<div class="post">
<h2 class="dotted"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
<p class="meta"><?php _e('Posted','cp'); ?> <?php echo cp_ad_posted($post->post_date); ?> <?php _e('by','cp'); ?> <?php the_author_posts_link(); ?> <?php _e('in','cp'); ?> <?php the_category(', ') ?> | <?php comments_popup_link( __('No comments yet', 'cp'), __('1 comment', 'cp'), __('% comments', 'cp')); ?></p>
</h2>
<?php if (has_post_thumbnail()) { the_post_thumbnail('blog-thumbnail');} ?>
<?php the_content('Continue reading »', 'cp'); ?>
</div><!-- /post-->
</div><!-- /shadowblock -->
</div><!-- /shadowblock_out -->
<?php endwhile; ?>
<?php if(function_exists('cp_pagination')) { cp_pagination(); } ?>
<?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.','cp'); ?></p>
<?php endif; ?>
<div class="clr"></div>
</div><!-- /content_left -->
<?php get_sidebar('blog'); ?>
<div class="clr"></div>
</div><!-- /content_res -->
</div><!-- /content_botbg -->
</div><!-- /content -->
<?php get_footer(); ?>
Here is what I believe to be the relevant piece of code from a settings php file.
function cp_pagination($before = '', $after = '') {
global $wpdb, $wp_query;
if (!is_single()) {
$pagenavi_options = array(
'pages_text' => __('Page %CURRENT_PAGE% of %TOTAL_PAGES%','cp'),
'current_text' => '%PAGE_NUMBER%',
'page_text' => '%PAGE_NUMBER%',
'first_text' => __('‹‹ First','cp'),
'last_text' => __('Last ››','cp'),
'next_text' => __('››','cp'),
'prev_text' => __('‹‹','cp'),
'dotright_text' => '',
'dotleft_text' => '',
'style' => 1,
'num_pages' => 15,
'always_show' => 0,
'num_larger_page_numbers' => 3,
'larger_page_numbers_multiple' => 10,
);
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if(empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = intval($pagenavi_options['num_pages']);
Thank YOu!
I tried the following but it didnae work:
$posts_per_page = 1;