WordPress redirect on login

I think getting the site to redirect to the proper location on login would only be the beginning of your issues with this setup. What would happen when you want to use any WordPress function to retrieve the site url? You would possibly have to re-write those functions as well, so that they return the … Read more

Get current WordPress page then add #post ID to the end

Your answer should return: “ so from there you just do this: $final_url = $URI.’#’.get_the_ID(); Which should echo http://mydomain.com/current/page#372 which is kinda good for linking. But if your looking for a “bookmarks” link it would be best practice to do this (inside the loop): echo ‘<a href=”‘.the_permalink().'” title=”‘.the_title().'”>’.the_title.'</a>’; Which will echo “Interesting Page” (note the … Read more

WordPress & PHP sessions

It is relatively simple. I’ve giving you a few steps. User visits your site and hit ‘Add to basket’ on an event. You need to send this data to server (as you wanted to store in php session). you can submit a form (for simplicity) either in synchronously or asynchronously (ajax). You need to submit … Read more

Nav Menu Display

Register your menus in functions.php like so: if ( function_exists( ‘register_nav_menus’ ) ) { register_nav_menus( array( ‘my_main_menu’ => ‘Main Menu: description’, ‘my_sub_menu’ => ‘Sub Menu: description’, ‘my_footer_menu’ => ‘Footer Menu: description’ ) ); } Add the menu to the template like so: <?php wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘theme_location’ => ‘my_main_menu’, ‘container_class’ => ‘main-menu’ ) … Read more

images in wordpress themes

Its never a good idea to store binary data in your database, take a look at this post: https://stackoverflow.com/questions/662488/would-you-store-binary-data-in-database-or-in-file-system and this post: https://stackoverflow.com/questions/5778380/why-store-binary-data-in-mysql In my opinion, its far faster to use the file system and here’s why: The image URL can be stored in a custom field by wordpress – this is very simple to … Read more

if is_home(), change class of menu-item-225 of wp_nav_menu

Rather than adding a class, just add a second selector to your .current_menu_item style of .home .menu-item-225. Not ideal, but for a single case, I think it’s completely appropriate. (This assumes that you’re using body_class() on your <body> element, but you should be doing that anyway.)

PHP Widget and do_shortcode

The problem was the double quotes which are needed in normal shortcode usage in posts and pages for some reason when using do_shortcode the double quotes in the attributes where breaking the function. Working code below <div> <?php $lat = get_field(‘woo_maps_lat’); $long = get_field(‘woo_maps_long’); echo do_shortcode(‘[forecast location=’ . $lat .’,’.$long. ‘]’); ?> </div>

wordpress taxonomy in regular posts

Yes, setting the $object_type, the second argument in the register_taxonomy function, set the value to an array including your custom post type slug and post. register_taxonomy($taxonomy, array(‘post’,’your-custom-post-type-slug’), $args); Review: http://codex.wordpress.org/Function_Reference/register_taxonomy Also check out my plugin http://wordpress.org/extend/plugins/reed-write/. It makes custom post types and custom taxonomies a breeze.