Chip Bennett
Forum Replies Created
-
Forum: Everything else WordPress
In reply to: Live Theme Preview Maker and DownloaderYes, it is certainly possible to code such a service.
I don’t think the question is really relevant for the WordPress support forums, though.
Forum: Plugins
In reply to: [cbnet Multi Author Comment Notification] UpgradeCan you tell me what your Plugin settings are? Also: what version of WordPress are you using, and what other Plugins do you have active?
Forum: Everything else WordPress
In reply to: Getting spammedYou should probably know the correct people to whom to complain. Perhaps the WHOIS record for that domain might be helpful.
But given that the site in question is still running WordPress 2.9.2, hasn’t posted anything since 2009, and is using a Theme linked to a spam site, I doubt contacting the owner would be very helpful.
Forum: Plugins
In reply to: [Scripturizer] bbpress buddypress and scripturizerIs BuddyPress doing anything strange with posts or post types?
Scripturizer essentially just adds a filter to
the_content, without specifying a post-type; so in theory,it should work with any registered post-type.Forum: Plugins
In reply to: [cbnet Multi Author Comment Notification] Will Not Send EmailsIf you disable the Plugin entirely, and all other Plugins, do you get comment notification emails?
Forum: Plugins
In reply to: [cbnet Multi Author Comment Notification] Slow to load on one siteI’m sorry; I wouldn’t know where to tell you to look for the cause of the slow loading. You shouldn’t see any load impact from the Plugin unless you’re on a user profile page, or Settings -> Reading, or submitting a comment (and thus invoking the email notification).
Well, it’s completely untested, so let me know if you encounter any issues; but I’ve added a site admin email option to version 3.1. You should find the checkbox right above the user role checkboxes in Settings -> Discussion.
Well, it’s completely untested, so let me know if you encounter any issues; but I’ve added a site admin email option to version 3.1. You should find the checkbox right above the user role checkboxes in Settings -> Discussion.
Forum: Themes and Templates
In reply to: Theme license with Jquery isotopeHi @bijay,
First, for Theme Review-related questions or issues, please use the Theme-Trac ticket system first. If your Theme is not-approved in a ticket, please post comments in that ticket, to try to resolve the issue. It is the fastest, easiest, and most-efficient way to ensure we answer your questions.
Second, regarding jQuery Isotope: the license isn’t GPL-compatible. The developer claims that Isotope can be used under the terms of the MIT license – as long as it isn’t used commercially. While the developer is fully within his rights to use such license terms, they don’t make sense, and they’re not compatible with the GPL.
Both GPL and MIT don’t impose usage restrictions; but the Isotope imposes a use restriction: commercial use requires a license purchase. I’m not even sure that the developer would have an actionable copyright infringement case if someone who uses Isotope under the “Open Source” license distributes his non-commercial code to someone else, who then uses that code for commercial purposes. Nevertheless, the official Theme Directory must protect end users against such license ambiguity.
Forum: Fixing WordPress
In reply to: Custom Taxonomy Template (Help Me Understand the Array)There are indeed many ways to skin a cat. That’s the beauty and power of knowing how to do query manipulations properly in the first place: it makes it much easier to manipulate it exactly the way you need/want to.
If the intent is just to make the very first-output post styled differently? There’s CSS for that, and ways in the query object to output a custom class for just the first post, via the
post_classfilter.(I must have missed the part about the post order being random; my mistake. 🙂 )
Forum: Fixing WordPress
In reply to: Custom Taxonomy Template (Help Me Understand the Array)*headdesk*
I feel your pain. 🙂
Okay, what’s happening here: WordPress executes in a specific order, based on a series of actions, that fall roughly in this order:
1. Initialize WordPress (init, etc.)
2. Read the URL query parameters (parse_request)
3. Parse the URL query parameters, and build the database query (parse_query)
4. Run the database query, and fetch the posts that match the parameters (pre_get_posts, posts_selection, posts_found)
5. Determine which template file to use to output the posts (template_include)
6. Redirect to that template (template_redirect)From that point, the template takes over (the stuff in your template file is executed).
So, as you can see,
pre_get_postsandposts_foundhappen *well before* your template code gets executed. By the time the code in your template is executed, you’re past the opportunity to modify the main query properly.So, if you want to modify the main query properly – i.e. at
pre_get_posts, you have to tell WordPress about your callback before the action fires. (Likewise with theposts_foundfilter.)The
functions.phpfile executes atplugins_loaded, which happens before the abridged list above. That’s why it’s suitable for adding callbacks forpre_get_postsandposts_found.WordPress will then use your callbacks, and adjust the query accordingly, before it ever runs the query. That way, pagination and all the normal loop things just work out-of-the-box, auto-magically.
Then, when you get in the template file, WordPress already knows how to handle the query – if it didn’t, it wouldn’t have selected that particular template file. At that point, you just want to let WordPress do its thing; if you attempt further manipulation of the query at that point, you’ll just confuse things, and stomp on your already carefully-crafted query.
Forum: Fixing WordPress
In reply to: Custom Taxonomy Template (Help Me Understand the Array)I neglected to mention: if the first-post special markup is only intended for the latest post, and only display on the first page of the taxonomy archive index, you should wrap it in an
is_paged()conditional:if ( ! is_paged() ) { $latest_totd = new WP_Query( /* args here */ ); if ( $latest_totd->have_posts() ) : while ( $latest_totd->have_posts() ) : $latest_totd->the_post(); // Custom, first-post loop markup here endwhile; endif; // IMPORTANT wp_reset_postdata(); }And I do think that two queries are appropriate here. We’re literally pulling the latest post out of the normal query, and treating it in a special way.
Forum: Fixing WordPress
In reply to: Custom Taxonomy Template (Help Me Understand the Array)So, the *right* way to do that in your template file would be:
1) A *custom* loop for the first post
2) Callbacks forpre_get_postsandfound_posts, moved tofunctions.phpBy *custom* loop, I mean something like:
$latest_totd = new WP_Query( /* args here */ ); if ( $latest_totd->have_posts() ) : while ( $latest_totd->have_posts() ) : $latest_totd->the_post(); // Custom, first-post loop markup here endwhile; endif; // IMPORTANT wp_reset_postdata();Then, just output your normal loop:
if ( have_posts() ) : while ( have_posts() ) : the_post(); // Normal loop markup here endwhile; endif;That’s all you need for your template file. The rest goes in
functions.php.Your pre_get_posts callback:
function totd_pre_get_posts( $query ) { // target the main query on the totd_cat tax template if ( $query->is_tax( 'totd_cat' ) && $query->is_main_query() ) { // apply offset here // Use your current code } } add_action( 'pre_get_posts', 'totd_pre_get_posts' );Then, your found_posts filter:
function totd_found_posts( $found_posts, $query ) { // Same query conditionals if ( $query->is_tax( 'totd_cat' ) && $query->is_main_query() ) { // Put your found_posts callback stuff here } } add_filter( 'found_posts', 'totd_found_posts', 10, 2 );And you should be good to go.
Forum: Fixing WordPress
In reply to: Custom Taxonomy Template (Help Me Understand the Array)What @christian1012 said. That’s the TL;DR.
I was going to get there, but I’m trying to do so in a way that helps you understand what’s happening with the query and template manipulations. 🙂
Forum: Fixing WordPress
In reply to: Custom Taxonomy Template (Help Me Understand the Array)Okay, let’s back up just a bit. I want to make sure I’m understanding what you’re wanting to do, and where it’s failing. Because that seems to be an awful lot of query manipulation for what’s actually getting rendered.
It looks like you just want
taxonomy-totd_cat.phpto be used to display the taxonomy term archive index? If so, you shouldn’t need any of the query manipulation you’re doing.What happens if you just output a loop, with all of the various query manipulations removed?