Order by & include array by specific post ids

use post__in key instead of include to get posts from the specific post ids. $args = array( ‘post_type’ => ‘testimonials’, ‘posts_per_page’ => 4, ‘orderby’ => ‘ID’, ‘post__in’ => array(883, 563, 568, 106), ); And to order posts by the given posts ids, you can use the following array. $args = array( ‘post_type’ => ‘testimonials’, ‘posts_per_page’ … Read more

Include WP_Query in my own PHP file?

Load WordPress in custom PHP Script: You need to load essential WordPress core functionality in your custom PHP script for WP_Query to work properly. For example, let’s say you have a custom PHP file named my-cron.php and WordPress is installed in the web root, like this: public_html/ index.php my-cron.php <– wp-load.php wp-settings.php … wp-admin/ wp-content/ … Read more

How to include a plugin’s php file to another plugin functions file [duplicate]

The first error message means that there is restrictions in place on where you can include files from, set by the server. You could try with require_once ABSPATH . ‘/wp-content/plugins/pluginname/pluginfunctions.php’; but I’m not sure if it would work. With the second include you’re trying to include an URL which is disabled by the server for … Read more

is_plugin_active() returning false on active plugin

is_plugin_active() expects just the base name of the plugin as parameter: So use: is_plugin_active( ‘woocommerce/woocommerce.php’ ); The function will use the option ‘active_plugins’ which is a list of plugins paths relative to the plugin directory already. On a multi-site installation it will search in get_site_option( ‘active_sitewide_plugins’) too. As an implementation note: Avoid these checks. Some … Read more

Should we use get_template_part() in functions files instead of include_once?

Your functions.php doesn’t create output, so you should use locate_template(). Example: locate_template( ‘php/functions.nav-menu.php’, TRUE, TRUE ); You’ll find this function in wp-includes/theme.php. The first parameter is the file path relative to the theme root, the second tells WordPress to load it (or not), and the third to load it just once. Now a child theme … 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)