Bernhard Riedl
Forum Replies Created
-
Forum: Plugins
In reply to: [TagPages] [Plugin: TagPages] PageTags cause tag results to lose menuCool. – You found the issue. 🙂 I’m also curious, so here’s an idea:
As I also use a
pre_get_posts-filter to manipulate thepost_typein$wp_query, it looks to me like a race condition between the two filters.Your code sets the
post_typetoarray('post', 'software', 'documents', 'news', 'nav_menu_item', 'page');if thepost_typehas not been set before.TagPages sets the
post_typetoarray('post', 'page')if thepost_typehas not been set before.So, if the TagPages-filter is executed before your filter, it will never reach your else-fork.
The default
$priority = 10for all filters, so I think setting your function to a higher priority (e.g. to9) would achieve the desired functionality.Forum: Plugins
In reply to: [TagPages] [Plugin: TagPages] PageTags cause tag results to lose menuHi whiteorb,
Hmm, I’ve never heard of such an issue before. – Maybe there’s a conflict with another plugin or your theme.
To test please deactivate all plugins and reload your test-page with only TagPages activated. If it worked, try to activate one plugin after another and reload the page each time.
If it didn’t work, try to setup one of the default themes (TwentyTen or TwentyEleven).
Greetz,
BernyHi huyz,
Thanks for the info and the link. – I’ve implemented the changes but unfortunately have no environment setup for testing. – Could you help me out and give the new version a spin on your system?
Here’s a link to my mail-address.
Cheers,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] Why not use builtin taxonmy functionality?Starting from version 1.40, TagPages uses the
$wp_queryobject instead of modifying the SQL query for post-tags archive-pages.greetz,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] meta data in headerNo, it doesn’t. – This meta-tag is solely dedicated to support and stats.
greetz,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] Fatal Error on line 46Hi Drew,
You’re welcome, though my help wasn’t that fruitful. 😉
>>By the way, what do you do for work?
As my day-job I currently work as a head of architecture and development for an online marketing company, but I’m in for interesting projects, thanks! Here’s my private contact page: http://www.neotrinity.at/contact-disclaimer/My Best,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] Fatal Error on line 46Hi Drew,
That’s even more strange. – Looks like your client’s host does not have these object-related language constructs (instanceof) enabled?
Anyway, if you want to continue on testing, please let me know, I don’t have much spare time, but I’m also curious…
Greetz,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] Fatal Error on line 46Hi Drew,
That’s really strange. – It seems like the checks against the tagpages object cause some error. – Can you try to change the following line (e.g. in your plugin-editor http://yourdomain.com/wp-admin/plugin-editor.php):
Original code:
if (empty($tagpages) || !is_object($tagpages) || !$tagpages instanceof TagPages)to
Variant 1:
if (empty($tagpages) || !is_object($tagpages) || !($tagpages instanceof TagPages))or to
Variant 2:
if (empty($tagpages) || !is_object($tagpages) || !is_a($tagpages, 'TagPages'))If it still doesn’t work, you can also try to delete this line completely. So only
$tagpages=new TagPages();will be left afterwards.Hope that helps.
greetz,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] Why not use builtin taxonmy functionality?I’ve raised a ticket.
Hi knn,
Sorry, I’m currently busy on my day-job and can therefore not extend GeneralStats. – Nevertheless GeneralStats is already multi-site enabled and will display the stats of each blog individually.
Greetz,
BernyForum: Plugins
In reply to: [TagPages] [Plugin: TagPages] Why not use builtin taxonmy functionality?True, I also thought this would be set to any, but apparently it doesn’t. 😉 I remember having some discussions about tagging of pages on the forums when WordPress 2.3 came out, but the core devs refused to include this functionality.
So there’s maybe also a historical reason why the post_type for taxonomy queries is automatically set to post. – I didn’t debug the code, though. – If you like to you can file a ticket in trac… Btw. this also applies for the custom column which holds the tags in edit.php for pages.
Anyway, you’re right that the extension of the post-types can also be done with a filter on the query_vars rather than modifying the SQL query itself. Cheers for this tip. 🙂
Here’s the code I’ve worked out. – It should also cover the possibility of custom post-type with post-tags scenarios. Maybe you can have a look. – If you like to, I can also send you the reworked plugin by mail.
add_filter('pre_get_posts', array(&$this, 'add_page_to_tags_query'));function add_page_to_tags_query($query) { if (is_tag() && !is_admin()) { /* if the post_type does not exist, we create it */ if (!array_key_exists('post_type', $query->query_vars)) $query->query_vars['post_type']=array(); /* if post_type is set to or includes any or page there's nothing more to do */ if (!empty($query->query_vars['post_type']) && (in_array('any', (array) $query->query_vars['post_type']) || (in_array('page', (array) $query->query_vars['post_type'])))) return $query; /* otherwise include post and page into post_type */ $query->query_vars['post_type']=array_unique(array_merge((array) $query->query_vars['post_type'], array('post', 'page'))); } return $query; }Forum: Plugins
In reply to: [TagPages] [Plugin: TagPages] "No Tags" when using page tags on a postHi,
I used a fresh install of WordPress 3.1 single install and multisite but couldn’t reproduce your second observation block. – In other words, I was able to add newly created post-tags for a test page on a test post (the other way round, too). Also the archive-pages in the enclosed TwentyTen theme worked as expected.
Have you probably installed some plugins which could interfere?
Greetz,
BernyForum: Fixing WordPress
In reply to: Display Posts for a specific Tag(s) on a Page?The reason is that, post is the default post_type according to the documentation of get_posts.
If you want to query for posts and pages use
'post_type' => array('post', 'page')as described in query_posts.Greetz,
BernyForum: Fixing WordPress
In reply to: Display Posts for a specific Tag(s) on a Page?Here you are…
<?php $args = array('tag_slug__and' => array('fruit-peru', 'fruit-misc')); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <ul> <li><?php the_title(); ?></li> </ul> <?php endforeach; ?>Forum: Fixing WordPress
In reply to: Display Posts for a specific Tag(s) on a Page?I think it doesn’t really make a difference if you use query_posts or create a new instance of WP_Query. I personally prefer the function, as this function is also documented in the API (template tags).
Anyway, if you implement get_posts instead, you don’t have to reset the ‘original query’.