How to add custom template tag in wordpress theme?
You can define your function in the file function.php and use it later in your theme.
You can define your function in the file function.php and use it later in your theme.
the_content doesn’t affect the DOCTYPE and <html> tags, only the post/page content. One of your plugins, or something else in the theme is either throwing an error, or is printing something earlier than it should. Have you tried: Disabling each plugin one by one and see when it is fixed. Editing wp-config.php and adding define( … Read more
Because I am very particular about how to do things in WordPress when it comes to looping, I couldn’t help but want to post a better way to do the above loop in your question as seeing the way you’ve done it looks like a lot of unnecessary work for yourself. You already answered your … Read more
Please try this way: Change date, the_date, the_time to get_date, get_the_date, get_the_time. function KhmerNumDate ($text) { $text = str_replace(‘1’, ‘១’, $text); $text = str_replace(‘2’, ‘២’, $text); $text = str_replace(‘3’, ‘៣’, $text); $text = str_replace(‘4’, ‘៤’, $text); $text = str_replace(‘5’, ‘៥’, $text); $text = str_replace(‘6’, ‘៦’, $text); $text = str_replace(‘7’, ‘៧’, $text); $text = str_replace(‘8’, ‘៨’, … Read more
I would keep the primary content field and add a metabox + a secondary instance of the wp editor (using the handy wp_editor function). Custom field values are stored in the database as LONGTEXT, so they can handle just about anything you wish to throw at them. A class to wrap everything up. There’s a … Read more
You could do it like this: function theme_styles(){ /* * This if() statement is unnecessary, as wp_enqueue_scripts * doesn’t fire on the admin pages. * if( is_admin() ) { * return; * } */ wp_enqueue_style( ‘theme-styles’, get_template_directory_uri() . ‘/css/all.css’, array(), false, ‘all’ ); } add_action( ‘wp_enqueue_scripts’, ‘theme_styles’ ); References is_admin() Also, note that the wp_enqueue_scripts … Read more
WordPress doesn’t add the frameborder attribute. YouTube does. It’s part of their embed code. If you absolutely must remove it you can use the embed_oembed_html filter to modify the returned HTML: function wpse_308247_remove_frameborder( $html, $url ) { // If the URL to be embedded is from YouTube. if ( strpos( $url, ‘youtube.com’ ) !== false … Read more
We can look into the wp_enqueue_global_styles() function, that calls wp_should_load_separate_core_block_assets() and see it contains e.g. the should_load_separate_core_block_assets filter but we can’t disable the global styles on the front-end, using this filter because of: /* * Global styles should be printed in the head when loading all styles combined. * The footer should only be used … Read more
The top bar of your theme is also positioned absolutely, so it doesn’t know to come down. You can use is_admin_bar_showing() to check to see if it’s showing, and then I’d probably just inject some styles using wp_head to move it down, since it’s very little CSS. All told, you’d get something in your theme’s … Read more
Inside the Loop, try something like the following: <?php if ( get_post_format() && in_array( get_post_format(), array( ‘audio’, ‘video’ ) ) ) { // The current post has either the // audio or video post format; // enqueue a script wp_enqueue_script( $handle, $src ); } ?> Now that WordPress can handle inline script-enqueueing, this should work … Read more