-
AuthorSearch Results
-
July 22, 2016 at 3:42 pm #51940
In reply to: Getting value from url
AnonymousInactive<?php echo $sf_current_query->get_fields_html(array("_sft_aantal_personen","_sft_arrangementstype","_sft_type_boot","_sft_type_boot_2","_sft_boot_opties"), array('show_all_if_empty' => false)); ?>
This…
July 22, 2016 at 3:16 pm #51933In reply to: Getting value from url
AnonymousInactiveHi Trevor,
I think it’s this part:
<?php //Get a multiple fields values by passing an array of field names //replace 1526 with the ID of your search form global $searchandfilter; $sf_current_query = $searchandfilter->get(15)->current_query(); ?> <?php $arrangement = $sf_current_query->get_fields_html(array("_sft_aantal_personen","_sft_arrangementstype","_sft_type_boot"), array('show_all_if_empty' => false)); ?>
I like to keep my echo’s separate from the rest… so I can echo them where ever I like.
May 25, 2016 at 12:21 pm #46642In reply to: Displaying datepicker field
TrevorParticipantOK, the
get_field('resource_date')
part needs to be inside a php function. See here:http://php.net/manual/en/datetime.createfromformat.php
Look at the example#2 towards the bottom.
Modifying what they have there.
$resource_date = DateTime::createFromFormat('Ymd', get_field('resource_date')); echo '<p class="lol-resource-date">' . $resource_date->format('F j, Y') . '</p>';
That might even compress down to:
echo '<p class="lol-resource-date">' . DateTime::createFromFormat('Ymd', get_field('resource_date'))->format('F j, Y') . '</p>';
May 24, 2016 at 7:28 pm #46544In reply to: Displaying datepicker field
AnonymousInactiveYes there is a template file and yes I added code for the ACF field. All the other ACF fields are working normally and pulling in the proper data, just not the date field.
This is the code for the date field (php tags are also in there):
echo ‘<p class=”lol-resource-date”>’ . get_field(‘resource_date’) . ‘</p>’;
May 10, 2016 at 7:18 pm #45212In reply to: Slow SF Page With Many Results
AnonymousInactiveNo problem – speedy recovery.
I think the problem lies with the code I have customized here for results.php in SFpro. It seems that maybe my conditional for the second part doesn’t take into consideration the arguments of the query. I end up with all the posts in my db generating equivalent modals. :
<?php /** * Search & Filter Pro * * Sample Results Template * * @package Search_Filter * @author Ross Morsali * @link http://www.designsandcode.com/ * @copyright 2015 Designs & Code * * Note: these templates are not full page templates, rather * just an encaspulation of the your results loop which should * be inserted in to other pages by using a shortcode - think * of it as a template part * * This template is an absolute base example showing you what * you can do, for more customisation see the WordPress docs * and using template tags - * * http://codex.wordpress.org/Template_Tags * */ // $term_list = wp_get_post_terms($post->ID, 'product_features', array("fields" => "all")); // foreach($term_list as $term_single) { // echo $term_single->slug; //do something here // } if ( $query->have_posts() ) { ?> <div class=""> <?php while ($query->have_posts()) { $query->the_post(); ?> <a class="col-md-6 col-lg-4 col-sm-6"> <article class="module-container eModal-post-<?php the_ID();?>" href="<?php the_permalink();?>"> <h3><?php the_title();?></h3> </article> </a> <?php if( get_field( "demo_module" )) { echo do_shortcode( "[modal id='post-". get_the_ID() ."' size='large' title='". get_the_title() ."']". "<div class='col-md-8'>" . get_the_content() . "<div class='demo-module'>" . "<a class='cta-button-v4' href='" . get_field( "demo_module" ) . "' target='_blank'>Download Demo Module</a>". "</div>" . "</div>" . "<div class='col-md-4'>" . do_shortcode("[module_author]") . "</div> <div class='col-md-12'><div class='cta-module'>" . do_shortcode("[cta_module_shortcode]") . "</div></div>" . do_shortcode("[wpdm_package id='". get_the_ID() . "']"). "[/modal]" ); } else { echo do_shortcode( "[modal id='post-". get_the_ID() ."' size='large' title='". get_the_title() ."']". "<div class='col-md-8'>" . get_the_content() . "</div>" . "<div class='col-md-4'>" . do_shortcode("[module_author]") . "</div> <div class='col-md-12'><div class='cta-module'>" . do_shortcode("[cta_module_shortcode]") . "</div></div>" . do_shortcode("[wpdm_package id='". get_the_ID() . "']"). "[/modal]" ); } ?> <?php } ?> </div> <?php } else { echo "No Such Modules"; } ?>
May 6, 2016 at 10:28 am #44867
TrevorParticipantSo, to use this plugin, in WP Admin go to Settings -> Post Snippets
Click Add New Snippet
In the title, give it a shortcode name (must be a valid WP slug name), for example:
my-color-link
Check the Shortcode and PHP Code checkboxes.
In the Snippet textarea copy and paste this:
$livit_kategorie = get_field('Kategorie'); $livit_barva = get_field('barva'); $livit_url = get_site_url() . '/fotogalerie-vysledky/'; echo '<strong><span style="color: #c62daa;">Kategorie</span></strong>: <a href="'; echo $livit_url; echo '?_sfm_Kategorie='; echo $livit_kategorie; echo '">'; echo $livit_kategorie; echo '</a><br /><strong><span style="color: #c62daa;">Barva</span></strong>: <a href="'; echo $livit_url; echo '?_sfm_barva='; echo $livit_barva; echo '">'; echo $livit_barva; echo '</a>';
There may be errors in that 😉 as I cannot test it here.
Now all you do is place that shortcode where you want those two lines:
[my-color-link]
May 5, 2016 at 7:16 pm #44809In reply to: Searching metadata contained in ACF ‘related’ post
AnonymousInactiveHi Trevor,
No, those fields are stored as metadata attached to the ‘resort’ CPT, not post ID’s.
I can query that data easily enough elsewhere on the site and display it, for example on any specific Deal, I can show the resort metadata by either using ACF’s “get_field” or “the_field” but I generally use the stock WP “get_post_meta($post->ID,’metakey’,true)”.
April 22, 2016 at 11:01 am #43630In reply to: How to style the search data
AnonymousInactiveThanks for this code, I had to adjust the code to add extra closing brackets for the STRING (below), unfortunately this results in the same data being given.
“Yacht Length: 40-50m”
<?php
global $searchandfilter;
$sf_current_query = $searchandfilter->get(339)->current_query();
echo $sf_current_query->get_field_string(“_sft_length”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_rate”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_guest”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_location”, array(“str” => “%2$s”));
echo $sf_current_query->get_field_string(“_sft_toy”, array(“str” => “%2$s”));
?>April 22, 2016 at 10:44 am #43625In reply to: How to style the search data
TrevorParticipantHi, can you try this code (it might be a step backwards, but bear with me):
global $searchandfilter; $sf_current_query = $searchandfilter->get(339)->current_query(); echo $sf_current_query->get_field_string("_sft_length", array("str" => "%2$s"); echo $sf_current_query->get_field_string("_sft_rate", array("str" => "%2$s"); echo $sf_current_query->get_field_string("_sft_guest", array("str" => "%2$s"); echo $sf_current_query->get_field_string("_sft_location", array("str" => "%2$s"); echo $sf_current_query->get_field_string("_sft_toy", array("str" => "%2$s");
April 21, 2016 at 5:17 pm #43567In reply to: How to style the search data
TrevorParticipantTry this (BTW, please use the code tags in the editor toolbar to enclose code 🙂 ):
get_fields_html(array("_sft_length", "_sft_rate", "_sft_guest", "_sft_location", "_sft_toy"), array('show_all_if_empty' => false));
-
AuthorSearch Results