Forum Replies Created
-
AuthorPosts
-
ckworld
ParticipantThanks again, GREAT SUPPORT
ckworld
ParticipantWorked like a charm, THANKS !
ckworld
ParticipantSORRY, IT DID WORK, just mistyped something.
Now how can I style the custom field results, for instance bold or difefrent color
ckworld
ParticipantNo that does not work, neither of the shortcodes show up.
I think I need an extra (different) code for the second custom field
-
This reply was modified 7 years, 2 months ago by
ckworld.
ckworld
ParticipantI just had to remove {pricemonth} from the Advanced Description Field.
Two more questions:
1.] The shortcode shows fine, but now I have no control over where it shows up in the results box. I am fine with the placement now, but interested to know how to let it show elsewhere, for instance right in the box etc.2.] I would like to put another shortcode ( availability ) in an other customfield. I tried the same code you provided with another extra custom field name, that does not work.
I tried this, but then it only shows the second customfield
—–
add_filter( ‘asp_results’, ‘asp_custom_field_to_results’, 10, 1 );
function asp_custom_field_to_results( $results ) {
$custom_field = ‘pricemonth’; // Enter the first custom field name
$custom_field = ‘availability’; // Enter the second custom field name
$field = ‘content’; // ‘title’ or ‘content’
$position = ‘before’; // ‘before’ or ‘after’
$delimiter = ‘ ‘; // character between the field value and the fieldforeach ($results as $k=>&$r) {
if ($r->content_type != ‘pagepost’) continue;
if ( function_exists(‘get_field’) )
$meta_value = get_field( $r->id, $custom_field, true ); // ACF support
else
$meta_value = get_post_meta( $r->id, $custom_field, true );
$meta_value = do_shortcode($meta_value);
// Modify the post title to add the meta value
if ( !empty($meta_value) ) {
if ( $field == ‘title’ ) {
if ( $position == ‘before’ )
$r->title = $meta_value . $delimiter . $r->title;
else
$r->title .= $delimiter . $meta_value;
} else {
if ( $position == ‘before’ )
$r->content = $meta_value . $delimiter . $r->content;
else
$r->content .= $delimiter . $meta_value;
}
}
}return $results;
}
————–
-
This reply was modified 7 years, 2 months ago by
ckworld.
ckworld
ParticipantFIXED it, shortcodes are now working (with your php code ) in the custom fields !!!!!
ckworld
ParticipantIs there a file in the Ajax Search Pro plugin itself to place the code, so it might work??
ckworld
ParticipantI do not understand why this is not working, because all the other shortcodes in the pages render fine.
ckworld
ParticipantSee printscreen, this is the custom field in the WordPress page with the name of the custom field and the shortcode (between brackets)
ckworld
ParticipantI put the code in the .functions.php of my child theme. Unfortunately it did not work. The results page just shows the shortcode ( [sc=name=”pricemonth”] )in plain txt, see printscreen
ckworld
ParticipantI tried this in the advanced description field:
<div class=”fusion-button-wrapper fusion-alignright”><span class=”fusion-button-text”>Details & Reserve</span></div>
<?php
$cf_value = get_post_meta(get_the_ID(), ‘pricemonth’, TRUE);
echo do_shortcode( $cf_value );
?>
Price / month {pricemonth}<br><br>
{teamlist}<br>Did not work
ckworld
ParticipantFound the solution myself! no help needed on previous question
ckworld
ParticipantThank you,, but I have still have to scrolt with a higher result limit. I want to show them all without the scrollbar and without the more results buttton
ckworld
ParticipantYeah, That;’s what I Thought!
Last question, I do not want the “More results” but I would like to show all results, where (how_can I change the 10 results into another higher number??
I do have quite a few questions, but that;s because your program is excellent with so many possibilities and choises
ckworld
ParticipantHere is the first printscreen (CSS)
-
This reply was modified 7 years, 2 months ago by
-
AuthorPosts