wp_enqueue_scripts not working in custom theme

I have found this small error in my code which stops wp_enqueue_scripts() to work in my theme was I forget to put wp_head in my head section. For another person who may make same mistake are advised to check that they have include wp_head in head part and wp_foot at end of your theme.

Change Page’s Tag Using functions.php File

Check this out function custom_title($title_parts) { $title_parts[‘title’] = “Page Title”; return $title_parts; } add_filter( ‘document_title_parts’, ‘custom_title’ ); In custom_title, $title_parts contains ‘title’, ‘page’ (the pagination), ‘tagline’ (the slogan you specified) and ‘site’. Set “title” the way you like.

Add rewrite rule to permalink structure

1. Add a new rewrite rule: add_action(‘init’, function() { add_rewrite_rule(‘^dog/([^/]+)/?$’, ‘index.php?cat=dog&name=$matches[1]’, ‘top’); }, 10, 0); 2. Filter the post link: add_filter(‘post_link’, function($post_link, $post, $leave_name = false, $sample = false) { if ( is_object_in_term($post->ID, ‘category’, ‘DOG’) ) { $post_link = str_replace($post->ID . ‘-‘, ”, $post_link); } return $post_link; }, 10, 4); Try it in your functions.php. … Read more

Customize plugin update “new version is available” text

Since the text is processed by _() function, then, of course, you can modify it using gettext filter. function change_update_notification_msg( $translated_text, $untranslated_text, $domain ) { if ( is_admin() ) { $texts = array( ‘There is a new version of %1$s available. <a href=”https://wordpress.stackexchange.com/questions/323927/%2$s” %3$s>View version %4$s details</a>.’ => ‘My custom notification. There is a new … Read more

How to transfer a WordPress blog to a different domain?

I recommend handling the 301 redirect in your web server rather than in WordPress. mod_rewrite or RedirectMatch will be much more efficient than spinning up WordPress to deliver a Location: header. <VirtualHost *:80> ServerName busted-cheap-url.com # mod_alias RedirectMatch permanent (.*) http://great-new-url.com$1 # OR mod_rewrite RewriteEngine on RewriteRule (.*) http://great-new-url.com$1 [R=301] </VirtualHost> There are several methods … Read more

How to add option box in “Edit Post” plugin API?

Below is the example of a couple of checkboxes to set custom field values: // register the meta box add_action( ‘add_meta_boxes’, ‘my_custom_field_checkboxes’ ); function my_custom_field_checkboxes() { add_meta_box( ‘my_meta_box_id’, // this is HTML id of the box on edit screen ‘My Plugin Checkboxes’, // title of the box ‘my_customfield_box_content’, // function to be called to display … Read more

Using functions from a plugin in your theme

Yes, you can use functions from plugins in your theme. Please use the function_exists() function to make sure that the function does exit. I used the Breadcrumbs Plus in one of the themes like this: <?php if (function_exists(‘breadcrumbs_plus’)) { $breadcrumb_options = array( ‘prefix’ => ‘<div id=”breadcrumb”>’, ‘suffix’ => ‘</div>’, ‘title’ => ‘Du er her: ‘, … Read more

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