Hi Experts,
I am having trouble with my "More Tag" working correctly.
I have a page template that pulls in posts from a specific category. I also have a custom 'single.php' file that loads a slightly different template for posts in this category.
I am having trouble with the more tag. The "read more" link will show up, but when you click it you get a Page not Found error.
Any insight you can provide is greatly appreciated.
Here are some code samples:
<strong>Code from page template that pulls in posts:</strong>
<ul class="news_list">
<li><?php
query_posts('cat=12');
global $more;
// set $more to 0 in order to only get the first part of the post
$more = 0;
// the Loop
while (have_posts()) : the_post();
// the content of the post
the_content('Read More →');
endwhile;
?></li>
</ul>
<strong>Code from single.php file that loads posts from the category above into a particular template:</strong>
<?php
if(in_category(12)) {
include 'single-12.php';
} else {
?>
...code for standards single template here ...
<?php } ?>
Oleg Butuzov answers:
remove more please....
Oleg Butuzov comments:
global $more;
// set $more to 0 in order to only get the first part of the post
$more = 0;
Oleg Butuzov comments:
sorry me wrong. we need at least a url to see the posts.
can you also provide a structure that you are using for the permanent links?
WP Answers comments:
http://www.airclic.com/news-resources/airclic-in-the-news-new
permalink structure is: /%postname%
Oleg Butuzov comments:
hm. it woks with the http://www.airclic.com/order%E2%80%99s-up
so its good. somehow it lost somewhere... i am getting such erros whan i am working with parse_query filter... can you add to your header.php next code to debug
<?php
var_dump($wp_query);
exit;
?>
to the top please.
Oleg Butuzov comments:
check is this artcile published not schelduled
WP Answers comments:
Hi,
If I edit the header.php file will the site still function?
The site is live and needs to stay functioning.
I have the new page I created hidden from the menu, so that is fine for now.
When I try to access the post directly, I get the 404 page not found error.
Maybe the error is not with "read more", but with the post itself?
http://www.airclic.com/temporary-media-coverage-post
Oleg Butuzov comments:
<?php
if (isset($_COOKE['BUTUZOV'])){
var_dump($wp_query);
exit;
}
?>
with this code site still will be aviable for a public and debug for me. also can i request admin login credentials to see post inside edition page?
WP Answers comments:
Hi,
I added the code to the top of header.php:
<?php
if (isset($_COOKE['BUTUZOV'])){
var_dump($wp_query);
exit;
}
?>
Which login credentials do you need? wp-admin?
Oleg Butuzov comments:
2Five Squared
yeah - wp-admin.
2 Guillermo
http://www.airclic.com/?p=1297 will give you same link. so its exists. but its hidden somehow.
Oleg Butuzov comments:
sorry in this code typo
if (isset($_COOKIE['BUTUZOV'])){
can you replace it?
WP Answers comments:
header.php is updated. Sorry about the delay.
Oleg Butuzov comments:
results inside...
here is query to db performed by query_posts...
SELECT distinct wp_posts.*
FROM wp_posts
LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
WHERE 1=1 AND wp_posts.post_name = 'temporary-media-coverage-post'
AND wp_posts.post_type = 'post' AND
NOT EXISTS (
SELECT *
FROM wp_term_relationships
JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
WHERE wp_term_relationships.object_id = wp_posts.ID
AND wp_term_taxonomy.taxonomy = 'category'
AND wp_term_taxonomy.term_id IN (9,1,6,4,12,11,5) )
ORDER BY wp_posts.post_date DESC
please take a look to the path of subquery witch is selecting posts that are not in some specific categories. for example category 12. witch is your posts in. something (perhaps plugin i did tell you about) changing sql to not select a posts in this categories. thats why it's not found.
Utkarsh Kukreti answers:
Link to site?
WP Answers comments:
http://www.airclic.com/news-resources/airclic-in-the-news-new
Guillermo Sornoza answers:
It sounds obvious, but have you try to recreate the post? If you see the "more" link, it points to
http://www.airclic.com/temporary-media-coverage-post#more-1297
And looks like you don't have a "temporary-media-coverage-post" named post.
WP Answers comments:
Hi,
I just tried to re-create but still get a "Page Not Found" error after click read more