Set Featured Image for Archive templates

There are lots of archives in WordPress. Tag archives, date archives, category archives, term archives, author archives. Which archive do you mean? You could start by trying the Taxonomy Images plugin http://wordpress.org/extend/plugins/taxonomy-images/

Overide get_template_part( ‘partials/post’, ‘sidebar’ ); with a plugin

TL;DR: Use a child theme instead 🙂 If we dig into the code for get_template_part(), there’s an action there – get_template_part_{$slug} – which we could hook into. Digging a bit further, get_template_part() calls locate_template(), which calls load_template(). Unfortunately, there’s nothing in either of these functions that seems to be pluggable, so we can’t hook in … Read more

Custom Taxonomy-specific JavaScript

For a function that enqueues scripts, the action hook you use should actually be “wp_enqueue_scripts” for the front of the site, and “admin_enqueue_scripts” for the admin side of things. This is the proper time to enqueue scripts. While you can technically do it anytime before wp_head, this is the best place because it’s pretty much … Read more

Page template in two level deep folder

WordPress will only search one level deep (*See below for details) from the root directory of the theme for page (and post) templates. However, the array of templates can be filtered using the theme_{$post_type}_templates filter, so you can add deeply nested templates on your own: // See WP_Theme::get_page_templates /** * Filters list of page templates … Read more

How to add plugins to wordpress theme?

You can always include the files of the plugins in your theme functions.php file. Of course you should put it into some reasonable structure to not get your theme bloated with the files and the code :). https://stackoverflow.com/questions/6974006/wordpress-package-plugin-with-theme How to bundle a plugin with a theme, or vice versa You can use code like this … Read more

Dynamic template serving, change theme_root using add_filter from current theme

You could also write your own simple get_template_part alias function: The following allows 3 subfolders for template parts that sit in a theme root folder named devices. <?php // STYLESHEETS function print_device_styles( $client=”desktop” ) { $client = apply_filters( ‘set_theme_client’, $client ); wp_enqueue_style( $client.’-css’ ); } add_action( ‘wp_head’, ‘print_device_styles’, 11 ); // TEMPLATE PARTS function get_device_template_part( … Read more

Create theme files for plugin

Here is the code that will let you return your single-event.php if the post type is event: function my_event_template($single_template) { global $post; if ($post->post_type == ‘event’) { return dirname( __FILE__ ) . ‘/single-event.php’; return $single_template; } add_filter( “single_template”, “my_event_template” ) ;

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