Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for navigation # issue
  • Loading branch information
briandunnigan authored and briandunnigan committed Feb 24, 2016
1 parent 40161ab commit a12a839
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 64 deletions.
134 changes: 70 additions & 64 deletions functions.php
@@ -1,65 +1,71 @@
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 2 );
function theme_enqueue_styles() {
wp_enqueue_style( 'sis-fonts', 'https://fonts.googleapis.com/css?family=PT+Sans:700', array('cs-style') );
wp_enqueue_style( 'sis-css', get_stylesheet_directory_uri() . '/css/sistertalk.css', array('cs-style') );
wp_enqueue_script( 'sis-js', get_stylesheet_directory_uri() . '/sistertalk.js', array( 'cs' ));
}

function enqueue_mobile_js(){
wp_enqueue_script( 'sis-mobile-js', get_stylesheet_directory_uri() . '/sistertalk-mobile.js');
}
add_action( 'init', 'enqueue_mobile_js', 0 );

function show_people(){
if ( !is_plugin_active('uc-people/uc-people.php') ) {
activate_plugin('uc-people/uc-people.php');
}
};
//add_action( 'after_switch_theme', 'show_people' );

function hide_people(){
if ( is_plugin_active('uc-people/uc-people.php') ) {
deactivate_plugins('uc-people/uc-people.php');
}
};
//add_action( 'switch_theme', 'hide_people' );
function hide_uup(){
global $wp_themes;

if ( is_plugin_active('uup/uup.php') ) {
remove_shortcode('uc_uup');
}
};
//add_action( 'init', 'hide_uup' );
function tfc_remove_page_templates( $templates ) {
unset( $templates['page-user-profile.php'] );
unset( $templates['user-index-table.php'] );
unset( $templates['user-index.php'] );
return $templates;
}
add_filter( 'theme_page_templates', 'tfc_remove_page_templates' );


add_filter( 'wp_head' , 'addToHead' );
function addToHead() {
echo '<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=0">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="SisterTalk">
<meta name="msapplication-TileImage" content="'. get_stylesheet_directory_uri() .'/img/144.png">
<meta name="msapplication-TileColor" content="#ffffff">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="'. get_stylesheet_directory_uri() .'/img/144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="'. get_stylesheet_directory_uri() .'/img/114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="'. get_stylesheet_directory_uri() .'/img/72.png">
<link rel="apple-touch-icon-precomposed" href="'. get_stylesheet_directory_uri() .'/57.png">
<link rel="shortcut icon" href="'. get_stylesheet_directory_uri() .'/img/144.png">
<link rel="manifest" href="'. get_stylesheet_directory_uri() .'/manifest.json">';

}

<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 2 );
function theme_enqueue_styles() {
wp_enqueue_style( 'sis-fonts', 'https://fonts.googleapis.com/css?family=PT+Sans:700', array('cs-style') );
wp_enqueue_style( 'sis-css', get_stylesheet_directory_uri() . '/css/sistertalk.css', array('cs-style') );
wp_enqueue_script( 'sis-js', get_stylesheet_directory_uri() . '/sistertalk.js', array( 'cs' ));
wp_enqueue_script( 'st-navigation', get_stylesheet_directory_uri() . '/navigation.js', array( 'cs-bootstrap-js'), '20120206', true );
}
add_action( 'wp_enqueue_scripts', 'theme_dequeue_styles', 999 );
function theme_dequeue_styles() {
wp_dequeue_script( 'cs-navigation' );
}

function enqueue_mobile_js(){
wp_enqueue_script( 'sis-mobile-js', get_stylesheet_directory_uri() . '/sistertalk-mobile.js');

}
add_action( 'init', 'enqueue_mobile_js', 0 );

function show_people(){
if ( !is_plugin_active('uc-people/uc-people.php') ) {
activate_plugin('uc-people/uc-people.php');
}
};
//add_action( 'after_switch_theme', 'show_people' );

function hide_people(){
if ( is_plugin_active('uc-people/uc-people.php') ) {
deactivate_plugins('uc-people/uc-people.php');
}
};
//add_action( 'switch_theme', 'hide_people' );
function hide_uup(){
global $wp_themes;

if ( is_plugin_active('uup/uup.php') ) {
remove_shortcode('uc_uup');
}
};
//add_action( 'init', 'hide_uup' );
function tfc_remove_page_templates( $templates ) {
unset( $templates['page-user-profile.php'] );
unset( $templates['user-index-table.php'] );
unset( $templates['user-index.php'] );
return $templates;
}
add_filter( 'theme_page_templates', 'tfc_remove_page_templates' );


add_filter( 'wp_head' , 'addToHead' );
function addToHead() {
echo '<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=0">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="SisterTalk">
<meta name="msapplication-TileImage" content="'. get_stylesheet_directory_uri() .'/img/144.png">
<meta name="msapplication-TileColor" content="#ffffff">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="'. get_stylesheet_directory_uri() .'/img/144.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="'. get_stylesheet_directory_uri() .'/img/114.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="'. get_stylesheet_directory_uri() .'/img/72.png">
<link rel="apple-touch-icon-precomposed" href="'. get_stylesheet_directory_uri() .'/57.png">
<link rel="shortcut icon" href="'. get_stylesheet_directory_uri() .'/img/144.png">
<link rel="manifest" href="'. get_stylesheet_directory_uri() .'/manifest.json">';

}

?>
67 changes: 67 additions & 0 deletions navigation.js
@@ -0,0 +1,67 @@
/**
* navigation.js
*
*/

jQuery(document).ready(function($) {

function replaceAnchors(selector) {
$(selector).each(function(){
var atag = $(this).children('a');
var newhref = getFirstLink(this);
atag.attr('href',newhref);
});
}
function getFirstLink(element){
var href = $(element).children('a').attr('href');
if(href == '#'){
var firstChild = $(element).children('ul').children('li').first();
if(firstChild.length == 0){
return href;
}
else {
return getFirstLink(firstChild);
}
}
else {
return href;
}
}

replaceAnchors('.dropdown-menu .menu-item-has-children');

});

/*
* Handles toggling the navigation menu for small screens.
*
( function() {
var container, button, menu;
container = document.getElementById( 'site-navigation' );
if ( ! container )
return;
button = container.getElementsByTagName( 'button' )[0];
if ( 'undefined' === typeof button )
return;
menu = container.getElementsByTagName( 'ul' )[0];
// Hide menu toggle button if menu is empty and return early.
if ( 'undefined' === typeof menu ) {
button.style.display = 'none';
return;
}
if ( -1 === menu.className.indexOf( 'nav-menu' ) )
menu.className += ' nav-menu';
button.onclick = function() {
if ( -1 !== container.className.indexOf( 'toggled' ) )
container.className = container.className.replace( ' toggled', '' );
else
container.className += ' toggled';
};
} )();
*/

0 comments on commit a12a839

Please sign in to comment.