<?php
$showposts = .1; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
'category__in' => $cat,
'showposts' => $showposts,
'caller_get_posts' => $do_not_show_stickies
);
$my_query = new WP_Query($args);
?>
<?php if( $my_query->have_posts() ) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<div class="latest_blog_post"><?php the_excerpt(); ?></div>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" class="readmore">Read More..</a>
<?php endwhile; ?>
<?php endif; ?>
I wrote a script where it displays a blog post in a header. It seems that when I put the script in one of my pages that’s not the blog that I get a error. All my pages have .php extensions. Does anyone know why the script doesnt work on my seperate pages just my blog?
What do you mean by ‘on my seperate pages just my blog’? How have you used/included the code above? have you stored the above code in a separate file and included it or directly you have put that code in a file? What error you have got?
I still get an error when I put that code in my file. I think the code isn’t working because my seperate pages are not intergrated within wordpress. Is their a way to code this up if my pages are just plain .php files?
What is your wordpress version?
Where is your about_us.php file stored in the folder structure?
I have already asked you to put that about_us.php file in the same folder where wordpress’s index.php, wp-config.php files are stored.
I don’t know what all the files are there. But you should put at least all those files where you want to use or you have used wordpress’s functions, classes and all. Or instead you can change the path of the including file. Like if your file about_us.php is in the root and wordpress is installed in the blog folder then try as follows once:
Did you try to implement my last suggestion for that? I am not sure whether it works or not because I havent included the WP’s config file outside of WP itself but hope this will work as I suggested above just by including the WP’s config file as follows:
Yeah, your code doesn’t work. I put my file in the same directory as wordpress and included the code that you just posted in my config file.
I’m still getting this http://cssispoetry.com/codeblog/about_us.php
Any other suggestions?