Show Site Favicon in Admin Area

conorseed

add_action( ‘admin_head’, ‘x_site_icons’ ); //admin favicon You can show your website favicon in the WP Admin area by adding the above code snippet to your child theme’s functions.php (Of course, you’ll need to have added your Site Icons in [Appearance -> Customizer -> Site Icons] for this to work)

Add Cart with Item Count in Menu

Donald McGuinn

Add this to your child theme functions.php file. //* Make Font Awesome available add_action( ‘wp_enqueue_scripts’, ‘enqueue_font_awesome’ ); function enqueue_font_awesome() { wp_enqueue_style( ‘font-awesome’, ‘//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css’ ); } /** * Place a cart icon with number of items and total cost in the menu bar. * * Source: http://wordpress.org/plugins/woocommerce-menu-bar-cart/ */ add_filter(‘wp_nav_menu_items’,’sk_wcmenucart’, 10, 2); function sk_wcmenucart($menu, $args) { // Check if WooCommerce is active and add a new item to a menu assigned to Primary Navigation Menu location if ( !in_array( ‘woocommerce/woocommerce.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) || ‘primary’ !== $args->theme_location ) return $menu; ob_start(); global $woocommerce; $viewing_cart = __(‘View your shopping … Read More

Embed video in Custom Page Template using ACF

jmacreations

Create an ACF URL Field (eg “video_link” ) Then use this code to add it anywhere in a page template. if( get_field( ‘video_link’ ) ) { $videoURL = get_field( “video_link” ); $videoShortcode = ‘[video width=”1280″ height=”720″ src=”‘ . $videoURL . ‘”]’; echo do_shortcode( $videoShortcode ); The code checks if there is a value, then stores that value as a variable (for easier use), then it stores the completed shortcode as a variable . It finally displays the output of the shortcode.

Show Today’s Date with a Shortcode

Donald McGuinn

Put this in your child theme’s functions.php file. // [date] function displaydate(){ return date(‘l, F jS, Y’); } add_shortcode(‘date’, ‘displaydate’); // end date SHORTCODE: [date]

Blog in Breadcrumb trail

shamrockoz

For Posts, when using a breadcrumb trail and clicking on tags, categories – all you see is “Home” > Tag or Category Name. The following snippet will allow you to see -: Home > Blog > Tag or Category Name. Where “Blog” upon click will drive you back to the Blog url. Use a child theme and add this to your functions.php file. Please note -: a freshly created PHP will need <?php to begin with else if you have other code added, then just add the following … Personalized code to drive to your particular blog url is in RED. … Read More

Add a Slider Above Blog

Donald McGuinn

// Adding a Slider on top of the Blog Page // ============================================================================= add_action(‘x_before_view_integrity__landmark-header’, ‘slider_above_blog_page’); function slider_above_blog_page() { if ( is_home() ) { echo do_shortcode(‘[rev_slider alias=”slider_alias”]’); } }   Looks like this is for integrity.

How to add terms and conditions checkbox for email form extension

delerean

You have to add in /wp-content/plugins/x-email-mailchimp/email-integration/views/site/shortcode-x-suscribe.php in line 185: &nbsp; <span class=”tag”>&lt;fieldset&gt;</span> <span class=”tag”>&lt;input</span> <span class=”atn”>type</span><span class=”pun”>=</span><span class=”atv”>”checkbox”</span> <span class=”atn”>name</span><span class=”pun”>=</span><span class=”atv”>”terms”</span> <span class=”atn”>value</span><span class=”pun”>=</span><span class=”atv”>”ok”</span> <span class=”atn”>required</span><span class=”tag”>&gt;</span> <span class=”tag”>&lt;span</span><span class=”tag”>&gt;</span><span class=”pln”>I accept </span><span class=”tag”>&lt;a</span> <span class=”atn”>href</span><span class=”pun”>=</span><span class=”atv”>”#”</span> <span class=”atn”>target</span><span class=”pun”>=</span><span class=”atv”>”_blank”</span><span class=”tag”>&gt;</span><span class=”pln”>terms and conditions</span><span class=”tag”>&lt;/a&gt;</span> &lt;/span&gt;<span class=”tag”>&lt;/fieldset&gt;</span>

Add Custom Post Type to the Recent Posts Element in Cornerstone

Donald McGuinn

function add_event_post_type( $types ) { $types[‘post_type_name‘] = ‘post_type_name‘; return $types; } add_filter( ‘cs_recent_posts_post_types’, ‘add_event_post_type’, 999 ); Add this in your child theme functions.php file.

Change hover text on Social Sharing Shortcode

XAdmin

Adding this PHP code to your Child Themes functions.php file will allow you to change the hover text when you are using the Social Sharing Shortcodes. add_filter(‘gettext’, ‘translate_text’, 20 ); function translate_text($translated) { $translated = str_ireplace(‘Share on Facebook’, ‘Your new text 1’, $translated); $translated = str_ireplace(‘Share on Twitter’, ‘Your new text 2’, $translated); $translated = str_ireplace(‘Share on Google+’, ‘Your new text 3’, $translated); $translated = str_ireplace(‘Share on LinkedIn’, ‘Your new text 4’, $translated); $translated = str_ireplace(‘Share via Email’, ‘Your new text 5’, $translated); return $translated; }   IMPORTANT: For GoDaddy users, you may have to disable the mu-plugins folder located … Read More

Add Menu for pages in Cornerstone Admin Bar

XAdmin

Add this code to your functions.php in your child theme. // ============================================================================= // Add Menu for pages in Cornerstone Admin Bar // ============================================================================= function create_pages_menu() { global $wp_admin_bar;$menu_id = ‘pages’; $wp_admin_bar->add_menu(array(‘id’ => $menu_id, ‘title’ => __(‘Pages’), ‘href’ => ‘/’)); $pages = get_pages(); foreach ( $pages as $page ) { $wp_admin_bar->add_menu(array(‘parent’ => $menu_id, ‘title’ => $page->post_title, ‘id’ => $page->ID, ‘href’ => get_permalink( $page->ID ), ‘meta’ => array(‘target’ => ‘_blank’))); } }