Forum Replies Created

Viewing 15 replies - 16 through 30 (of 45 total)
  • Thread Starter formica

    (@formica)

    Ahhh… makes sense. Thankyou. Sorry for not fully explaining, the current template didn’t occur to me. I’m now so close.

    If i print_r that i get:

    Array ( [0] => stdClass Object ( [term_id] => 6 [name] => Acupressure [slug] => acupressure [term_group] => 0 [term_taxonomy_id] => 12 [taxonomy] => therapies [description] => [parent] => 0 [count] => 2 ) )

    Which i encouraging as it’s picking up the term.

    All i need to do now is get that term in your above query

    $args = array(
      'post_type' => 'therapist',
      'post_status' => 'publish',
      'tax_query' => array(
    		array(
    			'taxonomy' => 'therapies',
    			'field' => 'slug',
    			'terms' => // get the current term name
    		),
    		array(
    			'taxonomy' => 'location',
    			'field' => 'slug',
    			'terms' => array( 'bristol' )
    		)
    	)
    );
    
    $my_query = new WP_Query( $args );

    Thanks for helping – i can finally see the end.

    Thread Starter formica

    (@formica)

    Hi, it’s on single.php

    Thread Starter formica

    (@formica)

    Hmmm… Thanks for your help but I’m Sorry I’m still struggling.

    How would I get it in the array, such as:

    array(
     'taxonomy' => 'therapies',
     'field' => 'slug',
     'terms' => $object->slug
    ),

    Perhaps more worryingly if I echo the ‘$current_tax_term_id’ elsewhere on the post i get nothing.

    I’ve registered the taxonomy ‘therapies’ under my custom post type of ‘therapists’. All seems to work, however I’ve also allowed the taxonomy ‘therapies’ to be under the standard wordpress ‘post’ type.

    So I’ve then created a standard post called ‘Acupressure’ and tagged it as ‘acupressure’ in the taxonomy of ‘therapies’. So why does it not echo it’s taxonomy term?

    I’m so confused ??

    Thread Starter formica

    (@formica)

    And relax…. thank you keesiemeijer. Seriously appreciated.

    Got myself in a serious muddle with taxonomies, I still am but I can see a bit of light now.

    Sorry last question, is there a way for it to dynamically get the current taxonomy of ‘therapies’ itself. I’m showing it on a post that’s already been tagged with the taxonomy of ‘acupressure’.

    ie. can get the current taxonomy for ‘therapy’ itself?

    Thanks.

    Thread Starter formica

    (@formica)

    Ahhh….. Gave up and used ‘if else’

    <a href="?range=a_i">A-I</a>
    <a href="?range=j_q">J-Q</a>
    <a href="?range=r_z">R-Z</a>
    
    <?php $range = $_GET['range'] ?>
    
    <?php if ($range == 'a_i') { ?>
    
    // show list  A - I
    
    <?php } elseif ($range == 'j_q') { ?>
    
    // show list  A - I

    So ugly it needs a bag but my brain hurts.

    Thread Starter formica

    (@formica)

    Ok getting nearer. I’ve found a way to display all post titles with multiple first letters a-i.

    I just need to create three links and pass that ‘variable’ so it displays posts with either ‘a-i’, j-q’, ‘r-z’ and can’t quite get it but feel i’m really close. Any help really appreciated.

    <a href="?range=a_i">A-I</a>
    <a href="?range=j_q">J-Q</a>
    <a href="?range=r_z">R-Z</a>
    
    <?php
    $a_i = "'A','B','C','D','E','F','G','H','I'";
    $j_q = "'J','K','L','M','N','O','P','Q'";
    $r_z = "'R','S','T','U','V','W','X','Y','Z'";
    
    $range=$_GET['range'];
    
    $postids=$wpdb->get_col($wpdb->prepare("
    SELECT      ID
    FROM        $wpdb->posts
    WHERE       SUBSTR($wpdb->posts.post_title,1,1) IN ($range)
    ORDER BY    $wpdb->posts.post_title"));
    Thread Starter formica

    (@formica)

    Hmmm… still scratching my head with this one. Let me narrow the question, is it possible to “order by” ‘range’?:

    $postids=$wpdb->get_col($wpdb->prepare("
    SELECT      ID
    FROM        $wpdb->posts
    WHERE       SUBSTR($wpdb->posts.post_title,1,1) = %s
    ORDER BY    $wpdb->posts.post_title",range ('A' , 'I')));
    Forum: Fixing WordPress
    In reply to: Orderby php help
    Thread Starter formica

    (@formica)

    vtxyzzy

    Thank you. You’re a legend! There should in theory only be a small amount of restaurants to loop through, guessing 50 max, so hopefully it’ll be ok.

    Ultimately I’m loosing hair trying to create a restaurant review system with https://www.ads-software.com/extend/plugins/comment-rating-field-plugin/ because I can’t get gd star rating in the new wordpress comment form without paying $100 for their tutorials. Ouch!

    Next is to work out all the above with my custom taxonomy, ie highest ‘Chinese’ restaurant. Any pointers / tutorials appreciated.

    Don’t even start me on the fact I’m not correctly working our the highest rating, ie 1000 people vote 1 star to a restaurant, that’s a bad restaurant with a lot of stars. 10 people vote 5/5 for another and it’ll show beneath the first. Maybe that $100 tut is looking cheap.

    vtxyzzy thanks again for all your help. Seriously appreciated.

    Forum: Fixing WordPress
    In reply to: Orderby php help
    Thread Starter formica

    (@formica)

    vtxyzzy That’s brilliant – thanks so much for taking the time to help. You’ve no idea how much I appreciate it.

    It works almost perfectly it outputs all ratings in a list (organised by highest rated first) but is there a way to limit it to display only one, the highest?

    If I use:

    'posts_per_page' => 1, 'order' => 'ASC',

    It will limit the output but ironically display only the lowest. ‘order’ asc / desc seems to have no effect. I’m guessing it’s to do with the new ‘rating sort’ function but I’m now so out of my depth it’s untrue.

    Forum: Fixing WordPress
    In reply to: Orderby php help
    Thread Starter formica

    (@formica)

    Hi vtxyzzy

    Thanks for looking.

    Code now in the pastebin: https://pastebin.com/DN3TAAWL

    Having the same problem. The tutorial is out of date for latest version of wp.

    Anyone?

    formica

    (@formica)

    In the style.css look for

    #branding img {
    height: auto;
    margin-bottom: -7px;
    margin-top:4px;
    }

    And remove the margin-top and bottom.

    Seemed to work for me.

    Yup… me too, just remove the secure-wordpress plugin folder.

    Had same issue. Now fixed, saved me hours – thanks for posting.

    Thread Starter formica

    (@formica)

    Just found solution using single_cat_title

    <?php if(is_category()) { single_cat_title(); } ?>

    Simple really.

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