fusiongt
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsOnly the pages in the category “browse-series” should query the volumes and chapters. I made a mistake and said the code you gave me worked – which it did, except it took away that limiting factor. The old code had this before it queries volumes and chapters:
<?php if (in_category(‘browse-series’)) { ?>
… all the huge querying goes here…
<?php } ?>
This way it isn’t chaos hehe.
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsWait it shouldn’t be like that. I’m going to revert back to the old code so you can see how it is. Please check again , https://manga.lyght.net
Btw it might be screwy without scroll bars, that’s ok (some javascript is doing it)
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postst31os, thanks…
Yes it’s on a live server but the site isn’t live yet so no worries (no visitors are seeing it).
Oh one thing I found was a problem,
<?php
#include (TEMPLATEPATH . ‘/ad_top.php’); if (in_category(‘browse-series’)) {Can you make the if (in_category(‘browse-series’)) { not commented (and maybe you need to close it I didn’t check) because I only want all the volumes and chapters listed if you’re in that category ‘browse-series’
Thanks!
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsbtw, here is that code in action: https://manga.lyght.net/browse/air-gear.html
It’s searching through a couple thousand entries so it takes a bit long to load
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postst31, yea that works
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsIt’s a bit modified from the MichaelH’s suggestion because I realized I didn’t need 2 different variables (so instead of searching through all “Series” and “Volume” I’m just searching through “Series Volume” which is more refined for me)
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postst31 sure, here you go: https://wordpress.pastebin.ca/1648596
thanks
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsThanks for the help… I can’t seem to get anything search related to show up. I put in the args and nothing shows up
<?php // display post title for any post that has both $findtext1 and $findtext2 in the post content $count=0; $findtext1 = 'Welcome'; $findtext2 = 'first'; $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC', 'showposts' => -1, 'caller_get_posts'=> 1, 's' => '%a%', 'exact' => true ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); if ( (strpos($post->post_content, $findtext1)!== false) && (strpos($post->post_content, $findtext2)!== false)) { $count++; if ($count ==1) { echo 'List of Posts containing "'.$findtext1.'" and "'.$findtext2.'"'; } ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php } //if (strpos endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>
I just kept the search query simple like you said ‘s’ => ‘%a%’, and I have a lot of posts that start with a or contain a, so something should have been returned.
By the way, I’m showing this in single.php
In single.php I call on this code only when:
<?php if (in_category('browse-series')) { ?>
So when there’s a post in browse-series, it will then try to fetch the specific keywords. The existing code on my site (MichaelH’s working code without the search string) gets the keywords from a custom field in the post which I get like this:
$seriestitle = get_post_meta($post->ID, $title, true); $findtext1 = $seriestitle;
Any ideas? Right now with the existing working code it’s taking a very long time trying to sort through the query (it takes 4-8 seconds to get what I want even with DB Cache activated). If I could sort it with search like you suggested I feel it’ll really improve the speed.
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsMichaelH, maybe I could contact you directly via email or chat (Google Talk or Skype?) to get some help on this. I could reimburse you for your time
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsSorry I mean is there a way to throw in the search args into your code Michael? I tried this but it didn’t work
<?php // display post title for any post that has both $findtext1 and $findtext2 in the post content $count=0; $findtext1 = 'Welcome'; $findtext2 = 'first'; $args = array( 's' => '%Something%+%Here%', 'exact' => true ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); if ( (strpos($post->post_content, $findtext1)!== false) && (strpos($post->post_content, $findtext2)!== false)) { $count++; if ($count ==1) { echo 'List of Posts containing "'.$findtext1.'" and "'.$findtext2.'"'; } ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php } //if (strpos endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?>
Of course the words Something Here were actually words I knew should return results but I couldn’t get anything to show up. Any help would be appreciated…
Forum: Fixing WordPress
In reply to: Need help hiding text if a query has no postsThanks Michael and t31
Micahel, I tried to use the new search $args that T provided with the existing code you gave me, but I couldn’t get anything to show up.
Can you please revise your code so instead of searching all the queries it just tries to return the search results? I could spend all day on it and not figure it out myself ?? I think this would also improve the speed a lot. Thanks again!
Michael you rock! It’s working great. However, one minor thing and that is this part:
if( $my_query->have_posts() ) {
echo ‘List of Posts containing “‘.$findtext1.'” and “‘.$findtext2.'”‘;It shows the text even if there are no posts (I tried adding some gibberish $findtext1 and $findtext2 and it didn’t have any results except the echo statement still showed).
Could you help me with that? Thanks!
Forum: Your WordPress
In reply to: A Newbie Blog Site – Critique RequestedI like it, but it’s a bit hard to read. I’d say bump up the gray text just a little brighter.
Also your server was a bit laggy, might want to look into that.
Forum: Your WordPress
In reply to: Attacked for using WordPress13 years of experience? That’s 1994… wow. I started in 1997 and I thought that was old. In 1994 I couldn’t imagine doing web design with my 486.
Anyways, that guy is stubborn and lives to be validated.
Forum: Your WordPress
In reply to: TipsTree dot com is open for businessNice site design and I like the super large RSS feed heh