Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

Creating Featured posts - endwhile not working?


  #1  
Old Apr 6, 2013, 06:22 PM
munchy_cool
 
14 posts · Mar 2013
Creating Featured posts - endwhile not working?

I am adding the below code to my index.php to retrive 3 posts from the Featured category but it does'nt seem to work and gets only 1 post and displays endwhile below it, can anyone help?

<div id=”featured”>
<?php
query_posts(‘posts_per_page=3&cat=301′);
if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>

<?php endwhile;?>

<?php wp_reset_query(); ?>
</div>
  #2  
Old Apr 7, 2013, 03:26 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
If you are doing that in the virtual template it won't work because you are using php that is not allowed in the 'limited php code'.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Apr 7, 2013, 06:14 AM
munchy_cool
 
14 posts · Mar 2013
then how do i do it, where do i put the code? any other way you can suggest?
  #4  
Old Apr 7, 2013, 07:52 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Try making a copy of the index.php virtual templete and call it category-yourcatname.php and see if that will work
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Apr 8, 2013, 05:17 PM
munchy_cool
 
14 posts · Mar 2013
so i added a new main template by copying index.php (named it category-news-2) that was the slug on my Featured category but I see no change in the main page, am I missing something.

below is the code in the new main template.

Code:
<!--<div id="container">-->

<?php get_header(); ?>


<div id=”featured”>
<?php
query_posts(‘posts_per_page=3&cat=301′);
if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>

<?php endwhile;?>

<?php wp_reset_query(); ?>
</div> 

<div id="main" class="row">


	<div id="content" class="cf col8">
		
		<?php bfa_content_nav( 'multinav1' ); ?>
		
		<?php bfa_loop( 'postformat' ); ?>
		
		<?php bfa_content_nav( 'multinav2' ); ?>
		
	</div>
	
	<div id="widgetarea-one" class="col4">
		<?php dynamic_sidebar( 'Widget Area ONE' ); ?>
	</div>

</div>
	
<?php get_footer(); ?>

<!--</div>-->
  #6  
Old Apr 8, 2013, 07:01 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
there is no current way, using the theme options, to limit the number of posts returned other than the 'dashboard->settings->reading->Blog pages show at most setting'

if you want to format the look/feel of a particular category:
1) toss your 'query_post' code in the trash
2) if your category is 'news' then the virtual template should be 'category-news'
3) create a copy of the subtemplate 'postformat.php and you can make changes there - remember you can only use HTML and the Limited PHP Code that is available.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Featured Image Now Not Working On Any New Posts After Upgrade anpbaystate New Versions, & Updating 2 Jan 20, 2012 06:22 PM
Featured Posts plugin evripidis Plugins & Atahualpa 1 Aug 5, 2009 09:31 PM
How to create a homepage with links to featured posts scrubbs Post-Kicker, -Byline & -Footer 9 May 31, 2009 06:22 PM
Featured posts in horizontal bar 1 technstuff Header configuration & styling 1 Feb 3, 2009 04:11 AM


All times are GMT -6. The time now is 05:31 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.