Code

Get Link to Featured Image for use in View

In functions.php create function and shortcode /** *************************************************** * get image src for featured image of post (large version) */ /* Register our short code at the appropriate time during the WordPress Boot process. */ add_action( ‘init’, ‘wpk_register_shortcodes’); function wpk_register_shortcodes(){ add_shortcode(‘my_get_thumbsrc’, ‘my_get_thumbsrc’); } /* Function to return the source url for the featured image of…

Read More

Load Custom JS Scripts

To load a custom js script when, for instance page ID 434 is loaded place the following in theme functions.php: // load our own validation script on page 434 add_action( ‘wp_enqueue_scripts’, ‘babelscribe_load_scripts’ ); function babelscribe_load_scripts() { // register your script location, dependencies and version wp_register_script(‘action_script’, get_stylesheet_directory_uri().’/js/actions.js’, array(‘jquery’)); // enqueue the script if (is_page(434)) { //…

Read More

Custom Widget Area

Register a Custom Sidebar as described here Add widget to the sidebar. Use the following in your template file to show the sidebar (custom widget area) // Custom widget Area Start if( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Left Column Widgets’) ) : endif; // Custom widget Area end where ‘Left Column Widgets’ is the registered name of the…

Read More

Include Path from Theme Folder

If you can’t use an absolute url to an include file due to server configuration you can use the ABSPATH WordPress constant: require_once(ABSPATH .’/Connections/boatparts.php’); If ABSPATH is not defined you can use this: require (dirname(__FILE__).”/makesessionid.php”);

Read More