Forum Replies Created

Viewing 15 replies - 16 through 30 (of 32 total)
  • Thread Starter fusiongt

    (@fusiongt)

    Only 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.

    Thread Starter fusiongt

    (@fusiongt)

    Wait 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)

    Thread Starter fusiongt

    (@fusiongt)

    t31os, 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!

    Thread Starter fusiongt

    (@fusiongt)

    btw, 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

    Thread Starter fusiongt

    (@fusiongt)

    t31, yea that works

    Thread Starter fusiongt

    (@fusiongt)

    It’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)

    Thread Starter fusiongt

    (@fusiongt)

    t31 sure, here you go: https://wordpress.pastebin.ca/1648596

    thanks

    Thread Starter fusiongt

    (@fusiongt)

    Thanks 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.

    Thread Starter fusiongt

    (@fusiongt)

    MichaelH, 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

    Thread Starter fusiongt

    (@fusiongt)

    Sorry 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…

    Thread Starter fusiongt

    (@fusiongt)

    Thanks 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!

    Thread Starter fusiongt

    (@fusiongt)

    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!

    I 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.

    13 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.

    Nice site design and I like the super large RSS feed heh

Viewing 15 replies - 16 through 30 (of 32 total)