marfarma
Forum Replies Created
-
Forum: Plugins
In reply to: [SyntaxHighlighter Evolved] SyntaxHighlighter changed php tags to entitiesSeeing the same thing in my javascript and unspecified code blocks. quotes become " etc.
Forum: Hacks
In reply to: Multiple custom field based queryThe last time I did something like this it turned out to be that the date wasn’t formatted the way I thought it was. The best place to start with something like this is to look at the actual sql statement that’s being build by examining the value of
$wp_query->request
If you install the developer tools plugin, you can use
krumo($wp_query->request );in place of echo and it will give you a nicer presentation of the results. If you can’t figure out what the sql statement is doing, paste it back here and we’ll see if we can help.
Yeah – he needs to update that screenshot caption. I had to read the FAQ again to figure it out.
The settings panel has a dependency on his kc-settings plugin. Once it’s installed the KC Media Settings panel will appear in the main settings drop-down.
I deleted them already.
I’m happy enough with my hack for now. I’ll upgrade to 3.2.1 as soon as I can confirm that all my plugins are supported. That’s what’s held me back so far.
OK – we have the following code
echo '<pre>'; print_r(get_queried_object()); echo '<br />'; print_r($wp_query->tax_query); echo '</pre>';producing the following output
stdClass Object ( [term_id] => 11 [name] => News [slug] => news [term_group] => 0 [term_order] => 0 [term_taxonomy_id] => 12 [taxonomy] => mytaxonomy [description] => [parent] => 0 [count] => 4 ) WP_Tax_Query Object ( [queries] => Array ( [0] => Array ( [taxonomy] => mytaxonomy [terms] => Array ( [0] => news [1] => event ) [include_children] => 1 [field] => slug [operator] => IN ) [1] => Array ( [taxonomy] => category [terms] => Array ( [0] => 1 ) [include_children] => [field] => term_id [operator] => NOT IN ) ) [relation] => AND )As you can see,
get_queried_object()only reports the first term – and would entirely miss any second taxonomy as well.I don’t believe that taxonomy terms are unique across taxonomy types. That’s why I expected an AND condition. I can imagine someone creating several rating taxonomies, each with the same terms.
Without specifying both the taxonomy name and the term, how could you differentiate between excellent service and excellent feature-set ratings?
What’s really weird is that the post_status is ‘auto-draft’
I’m on 3.1.4 — I guess there’s a bug there for custom post types.
No can’t delete them from the admin – only via direct mysql access.
I’m using taxonomy archives with advanced taxonomy queries for listings of posts with taxonomy term1 OR term2.
When I created a sidebar with my taxonomy and term1 selected it replaced the host sidebar on any taxonomy term page, not just for term1. Perhaps I inadvertently specified that the sidebar should show for taxonomy OR taxonomy->term1 condition? I expected it would be an AND condition.
My thought was that archive pages didn’t support custom taxonomy term level filter.
I really want to show a sidebar when the WP_Tax_Query Object includes a query that matches this one — when two specific terms are included in an or condition.
[queries] => Array ( [0] => Array ( [taxonomy] => mytaxonomy [terms] => Array ( [0] => term1 [1] => term2 ) [include_children] => 1 [field] => slug [operator] => IN ) )The problem is that the sidebar custom post type doesn’t allow for inputs that would support it. Any suggestion?
Auto Drafts are pulled from the database in my case: Screen Shot
Additional discussion here: http://wprocks.com/forums/comments.php?DiscussionID=2155
The following code change fixed it.
/** * * Create sidebars from content types * */ public function create_sidebars() { $posts = get_posts(array( 'numberposts' => 0, 'post_type' => 'sidebar', 'post_status' => array('publish','private','future') )); foreach($posts as $post) if ('Auto Draft' != $post->post_title) register_sidebar( array( 'name' => $post->post_title, 'description' => $post->post_excerpt, 'id' => 'ca-sidebar-'.$post->ID, 'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', )); }Well that doesn’t work.
I’ll have to disable auto-save for the moment – I can live without it better than I can with Auto Draft sidebars being created at random.
Any suggestion to prevent sidebars from being created as Auto Draft?
Of course that should read
if($post_type == 'sidebars') wp_deregister_script( 'autosave' );