Add theme templates for child categories into the template hierarchy

Don’t use template_redirect to load alternate templates as you can break any functionality that uses this hook to run on a lower priority than yours. The right hook is template_include. This is according to Mark Jaquith, one of the WP lead developers. https://markjaquith.wordpress.com/2014/02/19/template_redirect-is-not-for-loading-templates/ That said, it might be more appropriate to use the category_template filter … Read more

Add class or ID to any WordPress function

If you have only one template it’s fine to do something like: echo ‘<p class=”whatever”>’ . get_the_excerpt() . ‘</p>’; However, if you have multiple templates and want to control the classes centrally, you can make a filter on get_the_excerpt as follows (but yeah, that would be in functions.php): add_filter (‘get_the_excerpt’,’wpse240352_filter_excerpt’); function wpse240352_filter_excerpt ($post_excerpt) { $post_excerpt=”<p … Read more

Error do_shortcode In WooCommerce Template

I solved this with dirty way.. hope someone else can provide more efficient solution, my final working code for problem above: $shortkode=”[zendesk_request_form size=”3″ group=”extra-field” subject=”Quotation For -wkwkwk-“]”; $shortkode = do_shortcode( $shortkode ); add_action(‘woocommerce_single_product_summary’, ‘quotation_form’, 61); function quotation_form() { $produk = get_the_title(); global $shortkode; $shortkode = str_replace(“-wkwkwk-“, $produk, $shortkode); echo $shortkode; } So i move out … Read more

How to find a file in WordPress themes [closed]

Open your Linten WordPress theme in a text editor or IDE then open inc/hook/custom.php file, inc and hook is directory/folder. Then find this function linten_footer_copyright and do whatever you want to do. Here’s the file link from WP theme repo – https://themes.trac.wordpress.org/browser/linten/1.0.6/inc/hook/custom.php#L112 How I found the right file Let me explain how I found your … Read more

How to override wp-admin styling

As noted by @Fusion, this has changed beginning with version 5. In order to override admin styles for 5.*, you need a hook in functions.php, something like this: function custom_admin() { $url = get_settings(‘siteurl’); $url = $url . ‘/wp-content/themes/my-theme/wp-admin.css’; echo ‘<link rel=”stylesheet” type=”text/css” href=”‘ . $url . ‘” />’; } add_action(‘admin_head’, ‘custom_admin’) Sources: WordPress Codex … Read more

Routing dynamic numeric slug to custom template

The easiest way is to simply create a custom rewrite endpoint. This is a two-fer. It will create our actual permalink structure and our query var in one go. Do note that after creating the below you will need to resave permalinks: Settings -> Permalinks -> save button. /** * Create Careers Endpoint * * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)