How to make page template with admin able to select NextGen Galleries to be part of the layout?

You can add galleries directly to a template by calling do_shortcode() to run the gallery shortcode. <?php echo do_shortcode(‘[nggallery id=”1″ template=”example”]’); ?> Edit: sorry, writing decaffeinated so short attention span 🙂 Add some custom fields to your product pages to let your client pick which gallery goes on that product. If you like, just use … Read more

Commenting on a post from the admin panel?

This creates a custom meta box and the contents of the textarea field it contains are being saved as a comment to the post. Please note: Built with code sample adapted from the Codex. Relevant functions: add_meta_box and wp_insert_comment. I removed comment_author_IP and comment_agent from the insert comment arguments. Not sure of the consequences. Bug: … Read more

Custom Post Title as search term

If you register the post type with public set to true, the titles will be included automatically. You shouldn’t have to do anything to make this happen. Something as simple as this from the Codex: function codex_custom_init() { $args = array( ‘public’ => true, ‘label’ => ‘Books’ ); register_post_type( ‘book’, $args ); } add_action( ‘init’, … Read more

After being hacked Fatal error: Call to undefined function get_header() in 404.php on line 1

“Generally this happens when someone has mistakenly put index.php from a theme in the WP install folder, where it overwrites the index.php that is the main WordPress file. Download WordPress again, and take the one file, index.php from its root folder, replacing the file you now have as index.php It sometimes means someone has loaded … Read more

Custom Links in Walker Class

Test for … $item->object=”custom” This is used for custom links only. $item->object is always the post type or the item type (category for example). Not sure what happens when someone registers a custom post type named custom 🙂

Registering multiple copies of a widget

You really need to be using the Widget API. Here is a widget shell to get you started. class WPSE_Widget_Shell extends WP_Widget { function __construct() { $opts = array( ‘description’ => ‘Brief description; shows on the backend’ ); parent::WP_Widget( ‘widget-id’, ‘Widget Name’, // shows on the backend $opts ); } function form($instance) { echo ‘backend … Read more

WordPress multiple user roles accessing on their information on one site?

You’ll need to combine some plugins and a couple of hooks. Apart from the role management, I’d recommend Adminimize: it’s quite powerful to clean up the dashboard based on user roles. And then: /** * When a registered user tries to visit a page for which he doesn’t have access, * i.e.: http:/example.com/wp-admin/plugins.php, * WordPress … Read more

where does my function output from load-* go?

Ok, I’ve solved my problem, though my question (why I need to put die() at the end of my load-* function to let it show) remains unanswered. I couldn’t find any way to use tb_show and at the same time send super global post variables to the destination url. tb_show simply calls a url and … Read more

Rewriting a page driven by custom fields to populate a page dynamically, like posts

WP_Query is your friend. Combined with featured images, you should be able to do this as a page template with a WP_Query call and loop. This is the html for the top post at the moment: <li class=””> <a href=”http://dsi.sva.edu/cheryl-heller-named-in-top-100/”> <img src=”http://dsi.sva.edu/wp-content/uploads/2013/01/public-interest-design.jpg” width=”332px”> </a> <span><b><p style:=”” color:=”” #f15c25;=””><a href=”http://dsi.sva.edu/cheryl-heller-named-in-top-100/”>Cheryl Heller was named one of the … Read more