mian117
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Thank You for your help, I have used the shortcode of checkout inside the builder, which was not supported by this plugin, now I have placed the shortcode of checkout in the WP editor, and it works fine.
Thank You
I assign both, parent and child.
Hi @hcabrera,
Here is the code which gets the top-level category.function smart_category_top_parent_id ($catid) { while ($catid) { $cat = get_category($catid); $catid = $cat->category_parent; $catParent = $cat->cat_ID; } return $catParent; } $postID = get_queried_object_id(); $category = get_the_category( $postID ); $catid = $category[0]->cat_ID; $top_level_cat = smart_category_top_parent_id ($catid);
Forum: Plugins
In reply to: [WordPress Popular Posts] Multiple Custom FieldsI’m impressed with this fast response. Thank You very much.
This solution solved the problem. I have tweaked it a bit to work as per my requirement for more than 1 custom field./** * Renders an alternative thumbnail from a custom field * if the post doesn't have a thumbnail. * * @author Hector Cabrera * @see https://www.ads-software.com/support/topic/multiple-custom-fields-10/ * * @param string $img_url The default 'No thumbnail' image URL * @return string $img_url The (modified) 'No thumbnail' image URL */ function wpp_thumbnail_fallback( $img_url, $post_id ) { // Post doesn't have a thumbnail so let's fallback // to the custom field one if ( ! has_post_thumbnail( $post_id ) ) { // Get the image URL from your custom field here // and then assign it to $img_url or return your URL if( get_field('graphic_910x512', $post_id) ){ $image_url_linkedin = get_field('graphic_910x512', $post_id); $img_url = $image_url_linkedin['url']; } else if( get_field('graphic_683x512', $post_id) ){ $image_url_linkedin = get_field('graphic_683x512', $post_id); $img_url = $image_url_linkedin['url']; } else if( get_field('xxl_graphic', $post_id) ){ $image_url_linkedin = get_field('xxl_graphic', $post_id); $img_url = $image_url_linkedin['url']; } } return $img_url; } add_filter( 'wpp_default_thumbnail_url', 'wpp_thumbnail_fallback', 10, 2 );
Viewing 4 replies - 1 through 4 (of 4 total)