How to make function appear in sentence?

You can use below code to display theme detail sentence. I have use wp_footer action,You can change hook as per your requirement. function logbook_info() { $theme_logbook = wp_get_theme(); $theme_name = esc_html( $theme_logbook->get( ‘Name’ ) ); $theme_uri = esc_html( $theme_logbook->get( ‘ThemeURI’ ) ); $theme_author = esc_html( $theme_logbook->get( ‘Author’ ) ); $theme_author_uri = esc_html( $theme_logbook->get( ‘AuthorURI’ ) … Read more

Use a filter on menu items that have children

There is indeed a filter, walker_nav_menu_start_el will be able to handle it for you! Take this code for example: function wpse356896_filter_primary_nav_menu_dropdown( $item_output, $item, $depth, $args ) { // Only for our primary menu location. if ( empty( $args->theme_location ) || ‘primary-menu’ !== $args->theme_location ) { return $item_output; } // Add the dropdown for items that … Read more

HTML block gutenberg templates

Adding it the way you’ve suggested is not possible, and adding inline style attributes would be bad practice. However, what you want is possible by adding CSS classes, e.g. array( ‘core/heading’, array( ‘level’ => 3, ‘className’ => ‘biggerh3’, ‘placeholder’ => ‘Bigger Heading Placeholder’ ) ), Then this CSS: .biggerh3 { font-size: 1.34em; } Or by … Read more

Include custom post type custom taxonomies in Categories widget

The widget class uses wp_list_categories() which supports all the parameters for get_terms() like taxonomy which you can use to make the widget lists categories in a taxonomy other than category. So your code would be: add_filter(‘widget_categories_args’, function( $params ) { // $params[‘post_type’] = array(‘post’, ‘recipe’); // post_type is not a standard parameter for get_terms() $params[‘taxonomy’] … Read more

reduce duplicate code in wordpress

function site_banner_section($args = null) { if (!$args[‘title’]) { You’re getting warnings from these lines Notice: Trying to access array offset on value of type null in C:\xampp\htdocs\wp-vs-5.3.2\wp-content\themes\personal\functions.php on line 4 Notice: Undefined index: subtitle in C:\xampp\htdocs\wp-vs-5.3.2\wp-content\themes\personal\functions.php on line 7 because $args might be null and you’re still trying to treat it as an array, and … Read more

Check if( selected() )

selected is just an equals if statement that outputs selected or not. It doesn’t perform any special checks, it just makes the code for <option> tags a bit nicer. Without the selected function, you’d need to use a ternary operator, or temporary variables, the code for outputting forms would be awful. As the official docs … Read more

Redeclare function after plugin activation

Ok with helps it’s working. So theme was ok in front of wordpress but wasn’t able to load in the admin so we changed the previous condition by : if (!function_exists(‘get_field’) && !is_admin()) { function get_field() { return; } function the_field() { return; } } but same problem with activation in the admin and it … Read more

Why still output /wp-content/themes/twentynineteen?

You need to deactivate and reactivate your theme. When a theme is activated the template and stylesheet values are set in the database. If you remove Template: from the child theme’s stylesheet, the template is still set to twentynineteen in the database, so get_template_directory_uri() will return its URL. Re-activating the theme will ensure that this … Read more