Wordpress PHP function question

Hello everyone. I have what I think might be a basic PHP question. I recently purchased a Wordpress theme. the designer is pretty adamant about what he will add and what not. One feature I love is the News Ticker. But it only showcases either new posts or random posts. I wrote him asking if it was possible to show posts by category. He said yes, if I could code. He said:

You can modify the query of breaking news in this function vw_get_breaking_news_posts of this file ’\themes\sprout\inc\breaking-news.php’.

This is a copy of that function:

*<?php

if ( ! function_exists( ‘vw_is_enable_breaking_news’ ) ) {
function vw_is_enable_breaking_news() {
if ( vw_get_theme_option( ‘enable_breaking_news’ ) ) {
if ( is_front_page() ) {
$is_enable_breaking_news = vw_get_theme_option( ‘show_breaking_news_on_front_page’ );

		} else {
			$is_enable_breaking_news = true;

		}

	} else {
		$is_enable_breaking_news = false;

	}

	return apply_filters( 'vw_filter_is_enable_breaking_news', $is_enable_breaking_news );
}

}

if ( ! function_exists( ‘vw_get_breaking_news_posts’ ) ) {
function vw_get_breaking_news_posts() {
$args = array(
‘post_type’ => ‘post’,
‘ignore_sticky_posts’ => true,
‘posts_per_page’ => 8,
‘offset’ => 0,
);

	$source = vw_get_theme_option( 'breaking_news_source' );

	if ( 'random' == $source ) {
		$args['orderby'] = 'rand';
	}

	return new WP_Query( apply_filters( 'vw_filter_breaking_news_query_args', $args ) );
}

}


Anybody has any suggestions about how I should do this? I’m no programmer but I feel there is another file missing where this one should point and have definitions of sorts for Wordpress.

Help is greatly appreciated.

MS

This is the piece of code that you are interested in

[php]
if ( ! function_exists( ‘vw_get_breaking_news_posts’ ) ) {
function vw_get_breaking_news_posts() {
$args = array(
‘post_type’ => ‘post’,
‘ignore_sticky_posts’ => true,
‘posts_per_page’ => 8,
‘offset’ => 0,
);
[/php]

You need to make it

[php]
if ( ! function_exists( ‘vw_get_breaking_news_posts’ ) ) {
function vw_get_breaking_news_posts() {
$args = array(
‘post_type’ => ‘post’,
‘ignore_sticky_posts’ => true,
‘posts_per_page’ => 8,
‘offset’ => 0,
‘cat’=> 999999,
);
[/php]

Change the 999999 to be your category number.

I have just found this article that is excellent at explaining the wp-query that should give you some more insight.

Sponsor our Newsletter | Privacy Policy | Terms of Service