Support » Plugins » [Plugin: Custom Field Template] cftsearch question

  • Looking for a way to code the ctfsearch into a theme’s php page. I want it to appear above the output of theloop, so users can use the search to filter the posts.

    Is there a php function that I can call that will behave as if there was a [cftsearch] on the page content?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Use the following way:

    <?php
    echo do_shortcode('[cftsearch]');
    ?>

    Thread Starter Ted Thompson

    (@yorokobi)

    Perfect, but I have another question – I have used sort=menu_order and orderby=ASC which works find, unless I use the cftsearch.

    Picking through the code I found that if I changed $_REQUEST[‘order’] = DESC to ASC in this part of your plugin:

    function custom_field_template_posts_orderby($sql) {
    		global $wpdb;
    
    		if ( empty($_REQUEST['order']) || ((strtoupper($_REQUEST['order']) != 'ASC') && (strtoupper($_REQUEST['order']) != 'DESC')) )
    			$_REQUEST['order'] = 'DESC';

    Then I get ASC order, so what do I need to do to NOT change your code, but satisfy the conditional statement so I get the ASC order I want?

    Thread Starter Ted Thompson

    (@yorokobi)

    BTW, there is a mismatched </p> tag on line 3229 causing validation failure, I simply deleted it.

    Thread Starter Ted Thompson

    (@yorokobi)

    Ok I figured it out. First I don’t need ASC anymore because I re-ordered my posts when I found that the next-post and last-post links were working backwards, but I still needed to impose orderby=menu_order.

    For normal post listing and search I have added orderby=menu_order to the query string right before “theloop” but what I didn’t know was how to add it to the CFTSEARCH.

    Turns out it’s easy. All I had to do was add:
    <input type="hidden" name="orderby" value="menu_order" /> to the “FORMAT” I was using for the search form.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Custom Field Template] cftsearch question’ is closed to new replies.