Shortcode to return data instead of outputting HTML?
Shortcode to return data instead of outputting HTML?
Shortcode to return data instead of outputting HTML?
How can I remove the wp_autop filter from a shortcode block in a block theme page template (twenty twenty-three)?
Woocomerce custom add to cart button edit functionality [closed]
If you have a strict list of allowed years: $allowed_years = array(‘2018’, ‘2019’, ‘2020’, ‘2021’, ‘2022’, ‘2023’, ‘2024’); Then why are you using regex when you can search for those years directly: function vyperlook_get_years_in_text( string $text, array $allowed_years ) : array { $found_years = []; // the years we found // for each year that … Read more
SOLUTION: I looked through Divi’s functions.php & saw that the term for the project tags is ‘project_tag’, so when I amended my $query args it now works! Thank you very much to everyone who responded 🙂 $query_args = array( ‘post_type’ => ‘project’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ‘posts_per_page’ => ‘3’, ‘project_tag’ … Read more
Use the wp_title filter, which passes the current title, separator, and location as arguments. It then appends the custom field value to the title if the conditions are meet. For more details :- Visit Link wp_title function wpse_224340_document_title($title, $sep, $seplocation) { global $post; // make sure the post object is available to us if (is_singular(‘mec-events’)) … Read more
You can use the main WP_Roles object to get an array of role names/labels, e.g. $role=”author”; $label=””; // if there is no label this will be used instead if ( wp_roles()->has_role( $role ) ) { // this protects us if the role does not exist. $role_names = wp_roles()->get_names(); $label = $role_names[$role]; // Author } echo … Read more
The default WP_Query object on the blog homepage is the feed of blog posts rather than the page itself, so you’ll need to grab the post ID manually and pass it to get_post_thumbnail_id(): function lwb_image_shortcode( $atts ) { // Attribute für den Shortcode festlegen $atts = shortcode_atts( array( ‘type’ => ‘featured’, // Welches Bild, Standard … Read more
You are getting that error because in the function parameter you are passing $content as 1st parameter but as per add_shortcode callback function it accepts 2 argument $atts – array $content – string It is basically trying to concat $atts param which is an array hence you are getting warning. Just update your code by … Read more
Please add below line in your functions.php file add_filter(‘wp_nav_menu_items’, ‘do_shortcode’); This line will execute do_shortcode to your menu items and if there is any it will execute the shortcode.