• wmguk

    (@wmguk)


    Hi Guys,

    I’m using Latest News plugin and its set to list title, hide content…

    I get the list of titles but then at the very bottom of the page (After I close the loop) I get all the content listed…

    * February 2011 Newsletter
    * January 2011 Newsletter
    * December 2010 Newsletter
    * November 2010 Newsletter
    * October 2010 Newsletter
    * New Website Launched

    TEST
    February 2011 Newsletter January 2011 Newsletter December 2010 Newsletter November 2010 Newsletter October 2010 Newsletter XXXX XXXX are pleased to announce the launch their new website today. We hope you find it easy to use and informative. Please feel free to contact us with any queries.

    My code is :

    <ul>
    <?php
            $args= array(
            'news_items' => 500,
            'title' => TRUE,
            'content' => FALSE,
            'before_title' => '<li>',
            'after_title' => '</li>'
       );
    
    jep_latest_news_loop($args);
    echo '</ul>';
    ?> <br>TEST<br>

    Any ideas why its dumping code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wmguk

    (@wmguk)

    Ah,

    Looks like its duplicating the code….

    My standard pages show:

    <?php get_header(); ?>
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    	<?php the_content(''); ?>
    
    	<?php endwhile; endif?>
    
    <?php get_footer(); ?>

    and this script shows:

    <?php
    /**
     * @package Latest-News
     * @author James Piggot
     * @version 0.2.0
     */
    /*
    Plugin Name: Latest News
    Plugin URI: https://chorosdesign.com/wordpress/plugins/
    Description: Allows Latest News posts to be input from the admin menu and tags to output the Latest News items on your templates
    Author: James Piggot
    Version: 0.2.0
    Author URI: https://chorosdesign.com
    License: GPL2
    */
    add_action('init', 'jep_latest_news_init');
    function jep_latest_news_init()
    {
      // Create new Latest-News custom post type
        $labels = array(
        'name' => _x('Latest News', 'post type general name'),
        'singular_name' => _x('Latest News', 'post type singular name'),
        'add_new' => _x('Add New', 'Latest News'),
        'add_new_item' => __('Add New Latest News'),
        'edit_item' => __('Edit Latest News'),
        'new_item' => __('New Latest News'),
        'view_item' => __('View Latest News'),
        'search_items' => __('Search Latest News'),
        'not_found' =>  __('No Latest News found'),
        'not_found_in_trash' => __('No Latest News found in Trash'),
        '_builtin' =>  false,
        'parent_item_colon' => ''
      );
      $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => 20,
        'supports' => array('title','editor','author','thumbnail','excerpt','comments'),
        'taxonomies' => array('category', 'post_tag')
      );
      register_post_type('latest-news',$args);
    }
    
    /*
    	Template function to output the latest news stories
    */
    function jep_latest_news_loop($args = null)	{
    	$defaults = array(
    		'news_items' => 500,
    		'title' => TRUE,
    		'content' => FALSE,
    		'before_title' => '<li class="h3">',
    		'after_title' => '</li>',
    	);
    
    	//global $paged;
    
    	$r = wp_parse_args( $args, $defaults );
    
    	$qargs=array(
    	   	'post_type'=>'latest-news',
    	   	'posts_per_page' => $r[news_items],
    		'paged' => $paged
    	);
    
    	query_posts($qargs);
    
    	while ( have_posts() ) : the_post();
    	?>
    <?php echo($r[before_title]);?>
    	<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    <?php echo($r[after_title]);?>
    	<?php endwhile;
     }
    ?>

    I’m gusessing the code of :

    while ( have_posts() ) : the_post();
    	?>
    <?php echo($r[before_title]);?>
    	<a>"><?php the_title(); ?></a>
    <?php echo($r[after_title]);?>
    	<?php endwhile;

    How can I sort out restricting the post output

    jamespiggot

    (@jamespiggot)

    Hello wmguk,

    I am the author of this plugin so would like to help you to get it working. Can you post the code of the page template that is causing the problem? Please post the code in wordpress.pastebin.com to avoid annoying the moderators here in the forums.

    Regards,
    James

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Latest News plugin – Trouble with output’ is closed to new replies.