WordPress wraps span tags into p tags

I have investigated this problem and recognized that it is not the TinyMCE fault, but the issue is caused by the the hook function wpautop instead. And tags are wrapped just before post is being displayed. So in order to fix this issue just remove the hook function like that. remove_filter( ‘the_content’, ‘wpautop’ ); This … Read more

Update to functions.php not showing in dashboard

It looks like I have solved my own problem. I’m guessing that a function like that creates a permanent change, regardless of whether the function remains in the functions.php file. So, to fix this, I just added a new function reversing this adding. Here is that function: function remove_theme_caps() { $role = get_role( ‘author’ ); … Read more

get_terms (or tax_query) for term of current post?

SOLVED This was what I was looking for and it works like a charm. function my_query_args($query_args, $grid_name) { $term_list = get_the_terms( get_the_ID(), ‘category’ )[0]->slug; if ($grid_name == ‘JTS-SINGLE’) { $query_args[‘tax_query’] = array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => array( $term_list ), ), ); } return $query_args; } add_filter(‘tg_wp_query_args’, ‘my_query_args’, 10, 2);

first paragraph of the_content as meta description

You can use the_excerpt() instead of the_content Reference link for filter your excerpt : show-first-paragraph Or you can also do this by callback function inside your loop using the function to modify the_content as below: function get_first_paragraph(){ global $post; $str = wpautop( get_the_content() ); $str = substr( $str, 0, strpos( $str, ‘</p>’ ) + 4 … Read more

How to create shortcode with html and php content?

To create a shortcode from your functions, you need to use the following code: function my_shortcode_function(){ if (get_option(‘pixieclash-standings-background’) && get_option(‘pixieclash-standings-background’) != null) { $background = esc_url(get_option(‘pixieclash-standings-background’)) } else { $background = get_stylesheet_directory_uri() . ‘/images/standings-bg.jpg’; } $headTxt = get_option(‘pixieclash-standings-section-heading-top’); $bottomText = get_option(‘pixieclash-standings-section-heading-bottom’); if(!empty($headTxt)){ $text_header=”<h4>”. esc_attr($headTxt);.'</h4>’; } else { $text_header=””; } if(!empty($bottomText)) { $text_footer=”<h3>”.esc_attr($bottomText); .'</h3>’; } else … Read more

Combine two active_callbacks into one on theme customizer

Maybe I’m misreading your question, but combining these two conditions in one anonymous function doesn’t look that difficult: ‘active_callback’ => function() use ( $wp_customize ) { $condition1 == $wp_customize->get_setting( ‘twsa_show_schedule’ )->value(); $condition2 == $wp_customize->get_setting( ‘twsa_show_active’ )->value(); return ($condition1 && $condition2); } For really smart thinking on active callbacks, read Otto’s take on them.

Default Nav Highlight

Assuming you are loading a single piece of content like one Post (unlike the homepage where you’re combining multiple Pages with JS), something like this should do it: <script type=”text/javascript”> $(document).ready(function(){ // get each menu item var hasHighlight = 0; // loop through to see if any have “current_page_item” class $(“#nav ul li”).each(function(obj) { if($(this).hasClass(“current_page_item”)) … Read more