• Resolved sasank

    (@sasank)


    hi friends im executing this code getting error:
    Parse error: syntax error, unexpected ‘wp_reset_postdata’ (T_STRING) in /home/content/p3pnexwpnas05_data01/74/2360274/html/wp-content/themes/hueman/functions.php on line 917

    function latestnews()
    	{
    
        $catid = 50;//$category->cat_ID; //Store the category ID as a variable to be used in WP_Query
    
        $args = array(
            'cat' => $catid,
            'posts_per_page' => 10,
        );
    
        $query = new WP_Query($args);   
    
        // Start the Loop. You can use your own loop here
            while ( $query->have_posts() ) : $query->the_post();
        ?>  
    
    <li>
                <?php the_title( '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a>' ); //Display only the title of the posts in the category ?>
            </li>
        <?php
            endwhile;
    		?>
    		<a href="http://localhost/bahujana/category/%E0%B0%A4%E0%B0%BE%E0%B0%9C%E0%B0%BE%E0%B0%B5%E0%B0%BE%E0%B0%B0%E0%B1%8D%E0%B0%A4%E0%B0%B2%E0%B1%81/">More News</a>
        <?php//endforeach;
    /* Restore original Post Data */
    wp_reset_postdata();
    ?>
    
    	<?php }
    add_shortcode('late', 'latestnews');

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Getting Error’ is closed to new replies.