How do I add version control to my workflow?

First of all, you need to recognize that there are two workflows here: yours and your client. Your Workflow Receive PSD Code HTML/CSS Code WordPress template Deploy theme to live WordPress site Their Workflow Devise required changes and email you Write posts Upload photos The Issue Implementing version control here has absolutely nothing to do … Read more

How to store widget fields data as an array?

You have to collect multiple fields under the same name like this … name=”collect[1]” name=”collect[2]” … and adjust your widget logic to this. Here is a very simple demo widget: <?php # -*- coding: utf-8 -*- /* Plugin Name: Store Options as array */ add_action( ‘widgets_init’, array ( ‘T5_Array_Options_Widget’, ‘register’ ) ); class T5_Array_Options_Widget extends … Read more

Getting failure when using filemtime() with wp_enqueue_style

It’s because you’re retrieving it via URL, but filemtime() requires a path. Use get_stylesheet_directory() instead. That returns a path: function pro_styles() { wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() .’/child-style.css’, array(), filemtime(get_stylesheet_directory() .’/child-style.css’), ‘all’ ); } add_action( ‘wp_enqueue_scripts’, ‘pro_styles’ );

When to use add_action(‘init’) vs add_action(‘wp_enqueue_scripts’)

A lot of plugin developers don’t do things the right way. The right way is to hook on to wp_enqueue_scripts like you’re trying to do. However, here’s the order of the hooks run in a typical request: muplugins_loaded registered_taxonomy registered_post_type plugins_loaded sanitize_comment_cookies setup_theme load_textdomain after_setup_theme auth_cookie_malformed auth_cookie_valid set_current_user init widgets_init register_sidebar wp_register_sidebar_widget wp_default_scripts wp_default_stypes admin_bar_init … Read more

after_setup_theme always runs

SOLUTION: after_switch_theme does exactly what I intended here. It fires after the theme is switched TO your theme. One of the solutions mentioned below uses switch_theme. This does not have the desired results, since it only happens upon switching away from your theme. Here is an article that I found as reference: http://core.trac.wordpress.org/ticket/7795#comment:29 Here is … Read more

Get the first image from post content (eg.: hotlinked images)

If you want display an image that is inserted into your content (a hotlinked image, for example), you must use a function like this (source): add in functions.php: function catch_that_image() { global $post, $posts; $first_img = ”; ob_start(); ob_end_clean(); $output = preg_match_all(‘/<img.+src=[\'”]([^\'”]+)[\'”].*>/i’, $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ //Defines a default image $first_img … Read more

The proper way to include/require PHP files in WordPress

If you check https://codex.wordpress.org/Function_Reference/get_template_directory_uri You will see get_template_directory_uri() returns a uri, not a server path. You should use instead the get_template_directory() function: include get_template_directory() . ‘subdir/filename.php’; For a plugin you can use the plugin_dir_path() function: include plugin_dir_path( __FILE__ ) . ‘subdir/filename.php’;

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