I need to add a custom “cover” to every new post — plugin or custom setup?

Another solution, that doesn’t invoke page attributes: Explanation: To-Do List Go and download the RW_Meta_Box Library. I’m one of the authors/contributers. The Plugins Here you can see two small plugins (which I wrote especially for your question). Input The first one is a dependency of the RW Meta Box library. You just change what you … Read more

Get current user data from external PHP page

You can… Load the file into the file where you want to display the ‘hey username’ message: <?php include(TEMPLATEPATH .’/check-user-hello.php’); ?> . Then in that file “check-user-hello.php” You need to put this code <?php if ( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); echo ‘Hey ‘ . $current_user->display_name; } else { echo ‘<a href=”‘. get_bloginfo(‘url’) .’/wp-admin” … Read more

ABSPATH not working! Any idea why?

If you just need that class included, and your script is located in the plugin directory, like /wp-content/plugins/pluginName/script.php, then you can do: require realpath(‘../../../wp-includes/class-phpass.php’);

What is the most efficient method for loading widgets in functions.php

Both are acceptable but not recommended. Use locate_template() instead because a child theme can overwrite the loaded file then. Example: $found = locate_template( ‘functions/my-custom-widget.php’, TRUE, TRUE ); The first TRUE tells WordPress not only to search for the file but to load it actually. The second makes it a require_once call. The function return the … Read more

Add few specific post ids to wp_query

Here is another way of doing it, specially if you need to work with the query object. The issue with merging queries is that you loose the correctness of the query object. My idea here is to run two separate queries, one very lean one to get post ID’s from the date_query query and then … Read more

where to include a php file

Variables have a certain scope. The PHP Manual explains that in detail. So when you set a variable you should know in which scope those are set. This depends on where you set them and how that file gets included. As Rarst already suggested, the function.php file is an ideal place as it gets included … Read more

Adding rich text editor to my plugin

wp_editor() outputs the textarea(html codes), so, maybe you dont need to use that in functions.php, but use inside the page’s source. (for example, in your plugin.php: <div class=”blabla> <form action=”” method=”POST”> <?php wp_editor( ‘Hi,its content’ , ‘desired_id_of_textarea’, $settings = array(‘textarea_name’=>’your_desired_name_for_$POST’) ); ?> <input type=”submit”> </form> </div> note: it may wont work for add_option function..

How to include class from addon after to be sure one class exists in the main plugin?

I found this answer which seems to be good. I used the hooks plugins_loaded and _admin_menu. The hook _admin_menu is before admin_menu so I can add an admin page menu. FooAddon.php namespace PluginFoo; class FooAddon{ public function __construct(){ // Install needed components on plugin activation register_activation_hook( __FILE__, array( $this, ‘install’ ) ); // Include dependencies … Read more

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