Beda Schmid

Document How to create a Rating System using Toolset

Often websites (like for example TukuToi or Booking and other service-based WebSites) require a rating or review system. While TukuToi developed the ToolWine Reviews & Ratings plugin to facilitate this task, sometimes you might want a very minimal …

Document How to Customise the WordPress Archive Title

Sometimes we want to customise the WordPress Archive title which WordPress creates automatically for us. For example, we may want to get rid of the “Category:” prefix in the Archive title or we may want to completely change the entire title – perhaps i …

Document Exclude specific Taxonomy Terms from a View Query

Sometimes, we want to have a View Custom Front End Search filtering our Loops by Taxonomy terms, but we may want to exclude a few of those Terms both from the results, and the Custom Search. Natively this is possible in Toolset by using a Query Filter …

Document Get all occurrences of substring

function tkt_get_contents($str, $startDelimiter, $endDelimiter) { $contents = array(); $startDelimiterLength = strlen($startDelimiter); $endDelimiterLength = strlen($endDelimiter); $startFrom = $contentStart = $contentEnd = 0; while (false !== ($conten …

Document Modify WP Grid Builder Facet HTML – add a title tag

In this filter we have access to the WP Grid Builder Facet HTML. It allows to perform simple str_replace() operations, or more complex actions, for example, adding a title tag to each facet, so on hover of the facet we can see the current Facet Option …

Document Change WP Query (pre_get_posts)

add_filter( ‘pre_get_posts’, ‘custom_wp_query’ ); function custom_wp_query( $query ) { if ( ! is_admin() && $query->is_main_query() ) { if ( is_archive() ){ if ( !is_tax( ‘your_tax’ ) && !is_404() ){ $query->set( ‘post_parent’, 0 …

Document Rename Registered Post Types

add_filter( ‘register_post_type_args’, ‘rename_registered_post_types’, 999, 2 ); function rename_registered_post_types( $args, $post_type ){ if( ‘post’ == $post_type ){//your post type to rename $args[‘rewrite’][‘slug’] = ‘your_custom_slug’; } return $ …

Document Add Custom Base URL to post Links

add_filter( ‘post_link’, ‘add_custom_base_to_post_links’, 10, 3 ); function add_custom_base_to_post_links( $post_link, $post, $leavename ) { if ( ‘post’ != $post->post_type || ‘publish’ != $post->post_status ) { return $post_link; } $post_link = …

Document Allow HTML in Excerpts

add_filter(‘get_the_excerpt’, ‘allow_html_in_excerpt’); function allow_html_in_excerpt($text) { // Fakes an excerpt if needed global $post; if ( ” == $text ) { $text = get_the_content(”); $text = apply_filters(‘the_content’, $text); $text = str_repla …