Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
business/functions.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
162 lines (131 sloc)
5.1 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* functions.php | |
This is the functions.php files. If for whatever reason you would like to input new functions into cornerstone or tweak ones that are already created (view original theme for more information) you can use this functions.php to overwrite it. ' | |
* | |
*/ | |
// Any custom js or css - Code to make your javascript work with the theme. | |
function starterkit_scripts() { | |
wp_enqueue_style( 'executive-css', get_stylesheet_directory_uri() . '/css/executive.css'); | |
wp_enqueue_script( 'starterkit-js', get_stylesheet_directory_uri() . '/javascripts/executive.js', array( 'jquery' )); | |
wp_enqueue_script( 'business-network-ga', get_stylesheet_directory_uri() . '/javascripts/business-network-ga.js', array( 'jquery' )); | |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
$maxMegaMenuActive = is_plugin_active('megamenu/megamenu.php'); | |
if ($maxMegaMenuActive){ | |
wp_dequeue_style( 'cs-megamenu' ); | |
wp_enqueue_style( 'business-megamenu', get_stylesheet_directory_uri(). '/css/business-mega-menu.css', array( 'cs-style' )); | |
}; | |
} | |
add_action( 'wp_enqueue_scripts', 'starterkit_scripts', 99); | |
// Replaces the excerpt "more" text by a link | |
function new_excerpt_more($more) { | |
global $post; | |
return '... <a class="moretag" href="'. get_permalink($post->ID) . '">Continue Reading</a>'; | |
} | |
add_filter('excerpt_more', 'new_excerpt_more'); | |
add_filter( 'the_content_more_link', 'modify_read_more_link' ); | |
function modify_read_more_link() { | |
return '<a class="moretag" href="'. get_permalink($post->ID) . '">Continue Reading</a>'; | |
} | |
function sherman_remove_theme_features() { | |
remove_theme_support( 'custom-header' ); | |
remove_theme_support( 'custom-background' ); | |
// remove_theme_support( 'post-formats' ); | |
} | |
add_action( 'init', 'sherman_remove_theme_features' ); | |
function sherman_customize_register( $wp_customize ) { | |
$wp_customize->remove_section('colors'); | |
$wp_customize->remove_section('background_image'); | |
$wp_customize->remove_section('nav'); | |
} | |
add_action( 'customize_register', 'sherman_customize_register' ); | |
function executive_header_split( $wp_customize ){ | |
$wp_customize->add_setting( 'titlesplit', //Give it a SERIALIZED name (so all theme settings can live under one db record) | |
array( | |
'default' => '3_9', //Default setting/value to save | |
'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? | |
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting. | |
'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? | |
) | |
); | |
$wp_customize->add_control('titlesplit', array( | |
'type' => 'select', | |
'label' => 'Title / Navigation Split', | |
'section' => 'title_tagline', | |
'choices' => array( | |
'3_9' =>'3/9', | |
'4_8' =>'4/8', | |
'6_6' =>'6/6', | |
'12_12' =>'2row' | |
) | |
) | |
); | |
} | |
add_action( 'customize_register', 'executive_header_split' ); | |
/* | |
add_filter('megamenu_nav_menu_args ', 'my_megamenu_nav_menu_args '); | |
function my_megamenu_nav_menu_args($defaults, $menu_id, $current_theme_location) { | |
$defaults = array( | |
'menu' => $menu_id, | |
'container' => 'div', | |
'container_class' => 'mega-menu-wrap', | |
'container_id' => 'mega-menu-wrap-' . $sanitized_location, | |
'menu_class' => 'mega-menu mega-menu-horizontal', | |
'menu_id' => 'mega-menu-' . $sanitized_location, | |
'fallback_cb' => 'wp_page_menu', | |
'before' => '', | |
'after' => '', | |
'link_before' => '', | |
'link_after' => '', | |
'items_wrap' => '<h1>HELLO FILTERS</h1><ol' . $attributes . '>%3$s</ol>', | |
'depth' => 0, | |
'walker' => new Mega_Menu_Walker() | |
); | |
$array = array($defaults, $menu_id,$current_theme_location); | |
return $array; | |
} | |
*/ | |
function executive_breadcrumbs(){ | |
$thisID = get_the_ID(); | |
$ancestors = get_ancestors($thisID, 'page'); | |
$ancestors = array_reverse($ancestors); | |
if ($ancestors) { | |
echo '<ol class="breadcrumb">'; | |
if (wp_get_nav_menu_object('precrumbs')){ | |
$defaults = array( | |
'menu' => 'Precrumbs', | |
'container' => false, | |
'items_wrap' => '%3$s', | |
'depth' => 1, | |
'fallback_cb' => false | |
); | |
wp_nav_menu( $defaults ); | |
} | |
foreach ($ancestors as &$ancestor) { | |
$ancestor_link = get_permalink($ancestor); | |
$ancestor_title = get_the_title($ancestor); | |
echo '<li><a href="'.$ancestor_link.'">'.$ancestor_title.'</a></li>'; | |
} | |
echo '<li class="active">'.get_the_title().'</li>'; | |
echo '</ol>'; | |
} | |
} | |
function press_link($id){ | |
$presslink = ''; | |
$external_link = get_post_meta( $id, 'external_link'); | |
$external_link = $external_link[0]; | |
if ($external_link){ | |
$presslink = $external_link; | |
} else { | |
$presslink = get_the_permalink(); | |
} | |
return $presslink; | |
} | |
function press_source($id){ | |
$src = get_post_meta( $id, 'story_source'); | |
if ($src[0]){ | |
echo '<p class="text-muted press-source">'.$src[0].'</p>'; | |
} | |
} | |
?> |