query posts
-
Does anyone happen to know where an expo on query_posts is to be found please. On Codex it is descibed as coming shortly. (1.5).
-
This is what I have for the “blog.php” file which is basically the index but on the blog template so that there could be a home page.
<?php if(!empty($post->post_password)) :
if(stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password) { // and it doesn't match the cookie
$output = get_the_password_form();
echo $output;
}
else : ?><?php query_posts("showposts=10"); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
~The rest of my loop~
I end up getting this error:Parse error: parse error, unexpected ‘:’ in /home/.nabbenna/yogaboat/cottonmill.info/wp-content/themes/daisyraegemini/blog.php on line 15
Any suggestions?
Well there is a period just before nabbenna ?
“Any suggestions?”
Without seeing the whole thing…do you have the closing endif in there after your normal loop content?
yes, I do have the closing endif.
That’s the current code for the blog.php file. Since it’s considered a “page” by WP, and I’m trying to have it show what the index normally would, I want to be able to PW protect the whole page. Hopefully you understand what I’m trying to get at.
That’s without your code.
-with your code
Hmm. You’ve hit a limitation to page templating. Or rather, password protection.
When you set a password on a post or Page, you’re protecting the content of that post, and not an actual document. If you were to run a regular iteration of The Loop before your custom post query, you’d see your Page is password protected–but only the contents of your Page, and not the page.
Ok, possible solution:
I’ve inserted a simplified loop to grab the Page’s password, and use it for your custom post query verification.
Note: I commented out your gravatar.php include, but forgot to uncomment it in the paste up.
I am still not quite getting this. Is it mandatory that the query runs inside the loop?
Thanks Kafkaesqui! That worked great!
Root: The query should run justbefore the loop from what I understand. But by doing so, you basically force your loop to show the query, therefore bypassing any password protection you may be using.
Well it doesnt work ??
Works for me! I’d like to thank lawtai for his persistence with this issue. ??
Mine is up too. Thanks guys and to Nick at MtDewVirus.
kafkaesqui, installed your password query and combined it as suggested with individual categories. this works also for what i need, besides of two things:
1) when entering the protected category by pw it shows all entries instead of only those from the protected one
2) i would like to exclude the entries (headers etc.) of the protected category from the mainpageyou can try it at https://www.eyetag.de/weblog
pw: testfor what reason do i have to put it into its own category template?
you could simply leave in index.php, couldn?′t you?thanks&cheers
ANYTHING WRONG WITH MY REQUEST?
guys, please help me out of this!
can?′t get further without your help! i?′m really wondering why some posts get ignored sometimes (like those on this topic)…
is it only because there?′s no quick solution to it? if there?′s anything i can do better in my problems description or anythng else to improve feedback rate, please let me know!again: thanks in advance!
etI’m trying to display a page at the top of my home page and the posts as normal below. However, the navigation links disappear in almost any combination of adding a Page to the top of the home page (I’ve tried plugins and my own variations).
I believe the problem is from calling the loop twice in the same page, which is not getting reset properly the second time thorugh. I even tried using my own WP query object. I did notice that the WP query object refers to a global post on the “the_post()” function. The use of globals in instance variables is what leads me to believe something isn’t getting reset properly.
This is my first time into the guts of WordPress, and I haven’t gone too far to debug the problem. Before I do, I wanted to see if anyone else is seeing the same problem.
This is two problems mixed together. Putting a *page* at the top is not quite the same as having a sticky or an initial query. Could you post your loop code?
I’m not familar with having a sticky, is this through a plugin?
Here’s the code at the top of my index.php in the theme:
<?php if (is_home() ) { ?>
<?php $h_query = new WP_Query('pagename=home'); ?><?php while ($h_query->have_posts()) : $h_query->the_post(); ?>
//post code
<?php endwhile; ?><?php } ?>
The code that displays the posts by default is the same below the code I added.
- The topic ‘query posts’ is closed to new replies.