Load content From Include File within plugin

A better solution might be to do it along the lines of /* In your main plugin file */ if ( ! defined( ‘YOUR_PLUGIN_ABSPATH’ ) ) { define( ‘YOUR_PLUGIN_ABSPATH’, dirname( __FILE__ ) ); } /* In any file of the plugin */ if( is_front_page() ) { /* adjust path if file.php is in a subfolder … Read more

add_feed failed to open stream

Remove the last / in include(TEMPLATEPATH . ‘/events.php/’); If you cannot find a file, check with file_exists( $path ) first. Also TEMPLATEPATH is deprecated now, use get_stylesheet_directory() instead. And your feed is located at /gpevent’, not/gpevents’ as Stephen Harris noted.

Using plugin_dir_path() with WordPress on MAMP

I’m not sure why this isn’t working for you. I usually set the plugin path constant using dirname(FILE) You could try: define(‘MR_PLUGIN_PATH’, dirname(__FILE__)); //echo MR_PLUGIN_PATH; include_once(MR_PLUGIN_PATH.’/phprets.php’); Also: Are you sure phprets.php exists. You say you have phrets.php (missing the p)

How and when to include shortcode source files

The pattern I use is: break code into modules using classes use spl_autoload_register() to load classes (thereby only included when used) have a class that is the plugin controller, with a method for each shortcode those methods generally do nothing but create instance of shortcode class and pass params Works for me, simplifies things greatly, … Read more

Custom metabox not working

Problem #1: First problem: inside home-meta.php, pull all of your add_meta_box() calls outside of the add_meta_boxes_home() callback, and get rid of the callback and add_action() call. You handle this already, with the add_meta_boxes_page callback in functions.php, that includes home-meta.php. Problem #2: Warning: Invalid argument supplied for foreach() in /Users/[my_mac]/Sites/[site_dir]/wp-content/themes/[site_theme]/metaboxes/home-meta.php on line 224 Assuming that this … Read more

file.php not loaded?

OK, so there’s a bunch of admin functions in wp-admin/includes. These are loaded at some point between the loading of the theme’s functions.php and the admin_init hook. But that are ONLY loaded for admin-side pages. They are not loaded for front-end pages or AJAX calls. If you want to use these functions in front-end pages … Read more

Is it ok to chop index.php and include files?

Yes, you can separate your code and markup into multiple files. Be aware of scope issues when you use include, but done carefully it should be no problem. Since you are in WordPress and building a theme, I would suggest get_template_part over a raw include. In many ways, “chopping” up your theme files is what … Read more

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