Number of latest news posts displayed and header advertising option questions

Hello,

First off, let me say that I really appreciate the Scholar and Daily themes along with all of their features. I am coming up with two requests or, should I say, "how to's." I would like to increase the number of Latest News posts that show up on the home page of BP Scholar. Is there some code that can be massaged or can something be done to increase the number of posts from within the theme options?

Secondly, I notice that the Daily theme offers the alternative to use Google AdSense in the header advertising block but Scholar does not - I know, because I have tried several times and get theme lockup and have to go back and reset/redo. Can something be done to allow the Scholar theme this option?

Thanks!

  • Tammie

    @arsenikos: Glad you like the themes. Ok lets have a look at each thing.

    Firstly, to increase the number of latest posts well you can do this under theme options for news and spotlight - do these settings not work for you? Or are you talking about having the blog / news template as your front page not the home page?

    As for the advert currently that is just an image in scholar but I will put it on the list for review as to enabling it to be adsense code - you can though replace the following lines to have it that way for now in header.php:

    <?php
    $advert = get_option('ne_buddyscholar_header_advert');
    $advert_title = get_option('ne_buddyscholar_header_advert_title');
    $advert_link = get_option('ne_buddyscholar_header_advert_link');
    ?>
    <?php
    if ($advert != "" && $advert_link == ""){
    ?>
    <div id="advert">
    <img src="<?php echo $advert; ?>" alt="<?php bloginfo('name'); ?>"/>
    </div>
    <?php
    }
    else if ($advert != "" && $advert_link != ""){
    ?>
    <div id="advert">
    " title="<?php echo stripslashes($advert_title); ?>"><img src="<?php echo $advert; ?>" alt="<?php echo stripslashes($advert_title); ?>">
    </div>
    <?php
    }
    else {

    }
    ?>

    Replace with:


    <div id="advert">Your code here</div>

    Not tested that but should work.

  • arsenikos

    Thank you for the code suggestion in order to use AdSense, I am going to try that out.

    As for the number of posts, I realize that the theme options allow a choice for number of posts on the home page for both "latest news" and "spotlight" however, the maximum is 6. I would like to use a higher number. Is there a code change that I could implement somewhere to allow that to happen?

    I also would be interested to know how to increase the number of posts showing when using the Blog/News template as well - there seems to be no option to increase it from the existing 5 posts.

    Thanks!

  • Tammie

    @arsenikos: Ok then you'd want to adjust the variables here in home.php - you could do this by creating a child version of the home file so that it doesn't get overwritten when you update the theme:

    <?php
    	$welcome_title = get_option('ne_buddyscholar_welcome_title');
    	$welcome_message = get_option('ne_buddyscholar_welcome_message');
    	$news_category = get_option('ne_buddyscholar_news_cat');
    	$news_amount = get_option('ne_buddyscholar_news_number');
    	$news_image_display = get_option('ne_buddyscholar_news_image_size');
    	$spotlight_category = get_option('ne_buddyscholar_spotlight_cat');
    	$spotlight_image_display = get_option('ne_buddyscholar_spotlight_image_size');
    	$spotlight_amount = get_option('ne_buddyscholar_spotlight_number');
    ?>

    This shows all the theme option variables. You can easily place your own for instance to set the spotlight amount and the news amount you can do this:

    $news_amount = 10;
    	$spotlight_amount = 10;

    Alternatively you could edit the theme-options file but I'd recommend you do it this way using the home.php in the child theme.

    To change for the blog/news template just change this line in the template-blog.php file:

    <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=&showposts=5&paged=$page"); while ( have_posts() ) : the_post();

    You would change the showposts= value for instance to make it 8:

    <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=&showposts=8&paged=$page"); while ( have_posts() ) : the_post();

    However, you may also want to look at your admin wordpress reading settings depending on if you are using the theme template or not. I don't know if you're using this template or the index.php / archive.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.