...

View Full Version : Total php noob here



lackex
02-16-2012, 11:45 PM
Hi guys,

I am having a hell of a time trying to figure out the code on my website

www.laurahenderson.org

I've only ever barely touched php. I want the sidebar to be closed when the page loads initially, but I didnt write the code (just downloaded a wordpress template) and was wondering if anyone could help me decipher this?

I think the sidebar is called homeBox and here's a bit of the code


<div id="homeBox" class="boxStuff<?php if(is_front_page() && !is_page_template('page_gallery.php')){?> activeBox<?php }?>">
<!--LOGO-->
<img id="logo" src="<?php echo $logo;?>" alt="<?php bloginfo('name'); ?>" /><!--end logo-->
<!--MENU-->
<?php if (has_nav_menu( 'main' ) ) { wp_nav_menu(array('theme_location' => 'main', 'container_id' => 'navigation', 'menu_id' => 'dropmenu')); }?>
<!--COPYRIGHT-->
<div id="copyright">
&copy; <?php echo date("Y "); bloginfo('name'); ?>. <?php echo $footerText;?>
</div>
</div>

Thanks for reading!

mlseim
02-17-2012, 12:52 AM
I would say this part is what gets loaded and active at the beginning:

<!--TAB STUFF-->
<ul id="navBox" class="openNav">
<!--MENU-->
<li id="homeNav"><a href="#homeBox" class="activeNav">MENU</a></li>
<!--INFO/LIST-->
<li id="contentNav">
<a href="#contentBox" class="">INFO</a>
</li>
<!--THUMBS-->
</ul>

There must be some javascripting that starts it out extended when the page loads.
You'll have to have someone actually look at several scripts to find out where that happens.

lackex
02-17-2012, 07:02 AM
wow i feel dumb, I found the js files and was messing around with them


jQuery.noConflict(); jQuery(document).ready(function(){

//VAR SETUP
var rightBg = jQuery('#rightBg'),
boxStuff = jQuery('.boxStuff'),
bgControls = jQuery("#bgControls"),
nextImg = jQuery('#nextImg'),
prevImg = jQuery('#prevImg'),
blogNav = jQuery('#blogNav'),
navBox = jQuery("#navBox"),
navBoxa = jQuery("#navBox a"),
navHeight = navBox.height(),
firstImg = jQuery('.wrapperli:first-child'),
lastImg = jQuery('.wrapperli:last-child'),
//iPad,iPhone,iPod...
deviceAgent = navigator.userAgent.toLowerCase(),
iPhone = deviceAgent.match(/(iphone|ipod)/);

//CLOSE FUNCTION
function closeSesame(){
jQuery('.activeBox').fadeOut(600,function(){
navBox.animate({right:"0%",marginRight:"20px"},800).removeClass('openNav');
jQuery(".activeNav").removeClass('activeNav');
rightBg.animate({width:"0%"},800);//HIDE RIGHT BG
bgControls.fadeIn(600);
}).removeClass('activeBox');
}

//OPEN FUNCTION
function openSesame(){
navBox.addClass("openNav").animate({right:"50%",marginRight:"2px"},800);//ADD OPEN NAV
rightBg.animate({width:"50%"},800,function(){//SHOW RIGHT BG
jQuery('.activeBox').fadeIn(600);//ADD ACTIVE BOX & FADE IN
navBox.fadeIn(600);
});
bgControls.fadeOut(300);
}

//OPACITY STUFF
rightBg.css({opacity:".85"});

//REMOVE TITLE ATTRIBUTE
jQuery("#dropmenu a").removeAttr("title");

//MENU
jQuery("#dropmenu ul").css("display", "none"); // Opera Fix
jQuery("#dropmenu li").hover(function(){
jQuery(this).find('ul:first').show();
},function(){
jQuery(this).find('ul:first').hide();
});
jQuery("#dropmenu ul li ul").parent().children("a").prepend("<span style='float:right;'>&rsaquo;</span>");

//PRETTY PHOTO
jQuery("a[href$='jpg'],a[href$='png'],a[href$='gif']").not(".wrapperli a").attr({rel: "prettyPhoto"});
jQuery(".gallery-icon > a[href$='jpg'],.gallery-icon > a[href$='png'],.gallery-icon > a[href$='gif']").attr({rel: "prettyPhoto[pp_gal]"});
jQuery("a[rel^='prettyPhoto']").prettyPhoto({
animation_speed: 'normal', // fast/slow/normal
opacity: 0.35, // Value betwee 0 and 1
show_title: false, // true/false
allow_resize: true, // true/false
overlay_gallery: false,
counter_separator_label: ' of ', // The separator for the gallery counter 1 "of" 2
//theme: 'light_rounded', // light_rounded / dark_rounded / light_square / dark_square
hideflash: true, // Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto
modal: false // If set to true, only the close button will close the window
});

//WINDOW LOAD
jQuery(window).load(function(){
//REMOVE WIDTH AND HEIGHT ATTRIBUTES FROM IMAGES
jQuery('.attachment-full, .attachment-post-thumbnail, .attachment-gallery').removeAttr('height').removeAttr('width');

//LOAD MESH BG
jQuery('#mesh').fadeIn(600);

jQuery('#loading').fadeOut(600);

//IF GALLERY PAGE
if(jQuery('body').hasClass('page-template-page_gallery-php')){
navBox.fadeIn(600);
bgControls.fadeIn(600);
jQuery(".wrapperli:first-child a").click();
//IF NOT GALLERY PAGE
} else {
openSesame();
}
});

//FADE CRUMBS IN/OUT ON SCROLL
jQuery('#pageContent').scroll(function(){
if(jQuery('#pageContent').scrollTop()>150){
blogNav.fadeOut(300);
} else {
blogNav.fadeIn(300);
}
});

//NAV BOX STUFF
navBox.css({marginTop:"-"+navHeight/2+"px"});
boxStuff.css({marginTop:"-"+navHeight/2+"px"});

//NAV BUTTON CLICK
navBoxa.click(function(){

//VAR SETUP
var thisBox = jQuery(this).attr('href');

//IF ACTIVE LINK, CLOSE STUFF
if(jQuery(this).hasClass('activeNav')){
closeSesame();
return false;

//IF NOT ACTIVE LINK
}else{

//IF CONTENT OPEN
if(navBox.hasClass("openNav")){
navBoxa.removeClass('activeNav');//REMOVE CURRENT ACTIVE NAV
jQuery(this).addClass('activeNav');//ADD NEW ACTIVE NAV
jQuery('.activeBox').removeClass('activeBox').fadeOut(300,function(){//REMOVE CURRENT ACTIVE BOX & FADE OUT
jQuery(thisBox).addClass('activeBox').fadeIn(300);//ADD NEW ACTIVE BOX & FADE IN
});

//IF CONTENT NOT OPEN
} else {
jQuery(this).addClass('activeNav');//ADD ACTIVE NAV
jQuery(thisBox).addClass('activeBox');
openSesame();
}
}
});

//CLICKING GALLERY IMG
jQuery(".wrapperli a").click(function(){

if(iPhone){
return false;
}else{
//GET HREF
var galleryHref = jQuery(this).attr('href'),
galleryTitle = jQuery(this).attr('title'),
imageInfo = jQuery('#imgInfo'),
itemNumber = jQuery(this).parent().index() + 1;
numberItems = jQuery('.wrapperli').length;

//CHANGE TITLE INFO
if(galleryTitle){
imageInfo.hide().html(galleryTitle + "&nbsp / &nbsp"+ itemNumber + " of " + numberItems).fadeIn(150);
} else {
imageInfo.hide();
}

//CHANGE CLASSES
jQuery(".wrapperli").not(this).removeClass('activeImg');
jQuery(this).parent().addClass('activeImg');

//IF MENU OPEN, CLOSE IT
if(navBox.hasClass("openNav")){ closeSesame(); }

//CHANGE BACKGROUND
jQuery.backstretch(galleryHref, {speed: 300});

return false;
}
});

//NEXT CONTROLS
nextImg.click(function(){
var activeImg = jQuery('.activeImg');
if(activeImg.length > 0){
if(activeImg.next().length > 0){
activeImg.removeClass('activeImg').next().addClass('activeImg').children().click();
} else {
activeImg.removeClass('activeImg');
firstImg.addClass('activeImg').children().click();
}
} else {
firstImg.addClass('activeImg').children().click();
}
return false;
});

//PREV CONTROLS
prevImg.click(function(){
var activeImg = jQuery('.activeImg');
if(activeImg.length > 0){
if(activeImg.prev().length > 0){
activeImg.removeClass('activeImg').prev().addClass('activeImg').children().click();
} else {
activeImg.removeClass('activeImg');
lastImg.addClass('activeImg').children().click();
}
} else {
firstImg.addClass('activeImg').children().click();
}
return false;
});

// Keyboard shortcuts
jQuery(document).keydown(function(e) {
var unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode == 39) { nextImg.click();} // right arrow
else if (unicode == 37) {prevImg.click();} // left arrow
});

});

and changed the open sesame to closed sesame here in the code


//IF CONTENT NOT OPEN
} else {
jQuery(this).addClass('activeNav');//ADD ACTIVE NAV
jQuery(thisBox).addClass('activeBox');
openSesame();
}
}
});

but now when the page loads the navbar wont show up at all. Any help/insight would be much appreciated!

mlseim
02-17-2012, 12:57 PM
Those functions should remain untouched.

The thing you have to find is when the "openSesame" function gets called.

Let me clarify ... did you change the part in red to "closeSesame"?
If you didn't try that ... try it now. Otherwise, we'll have to do more digging.


//WINDOW LOAD
jQuery(window).load(function(){
//REMOVE WIDTH AND HEIGHT ATTRIBUTES FROM IMAGES
jQuery('.attachment-full, .attachment-post-thumbnail, .attachment-gallery').removeAttr('height').removeAttr('width');

//LOAD MESH BG
jQuery('#mesh').fadeIn(600);

jQuery('#loading').fadeOut(600);

//IF GALLERY PAGE
if(jQuery('body').hasClass('page-template-page_gallery-php')){
navBox.fadeIn(600);
bgControls.fadeIn(600);
jQuery(".wrapperli:first-child a").click();
//IF NOT GALLERY PAGE
} else {
openSesame();
}
});

lackex
02-17-2012, 02:43 PM
Yes, I tried changing that, but now the navigation bar won't even show up! It is completely hidden.

Is it possible that I have to call on something else as well to get it to show up?

mlseim
02-17-2012, 03:22 PM
OK ...
We'll have to dig somewhere else to find where it is being called when the site loads.

Back to the "index.php" in your theme folder ...
Can you list that?
They might have a separate index page for the main page and the rest of the blog.
Like, "main_index.php" and "blog_index.php" or something like that?
It could also be in the "header.php" or "footer.php" files.

Somehow, when the initial page loads, it is "openSesame" on that function.
We have to find where that is occurring.

.

lackex
02-17-2012, 08:23 PM
Here is the index.php code:


<?php get_template_part('archive');?>

There is nothing like a "main_index.php" or "blog_index.php"

but there is a sidebar.php:


<?php if ( is_dynamic_sidebar() ) { ?>
<div id="widgetBox" class="boxStuff">
<ul>
<?php dynamic_sidebar(); ?>
</ul>
</div><!--end widgetBox-->
<?php } ?>

header:


<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="initial-scale=1.0,width=device-width" />
<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php
//OptionTree Stuff
if ( function_exists( 'get_option_tree') ) {
$theme_options = get_option('option_tree');
$light = get_option_tree('light',$theme_options);
$googleApi = get_option_tree('google_api',$theme_options);
$googleKeyword = get_option_tree('google_keyword',$theme_options);
$logo = get_option_tree('logo',$theme_options);
$footerText = get_option_tree('footer_text',$theme_options);
$color = get_option_tree('color',$theme_options);
$favicon = get_option_tree('favicon',$theme_options);
$css = get_option_tree('css',$theme_options);
}
?>

<?php if($favicon) { ?><link rel="icon" href="<?php echo $favicon; ?>" type="image/x-icon" /><?php } ?>

<?php if($googleApi) { echo $googleApi; } ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php if($light){?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/light.css" type="text/css" media="screen" />
<?php } ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/scripts/prettyPhoto.css" type="text/css" media="screen" />
<?php
//IF iPhone/iPod, LOAD iPhone CSS FILE
if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT'])) {$iphone = 1;}
elseif (ereg('iPod',$_SERVER['HTTP_USER_AGENT'])) {$iphone = 1;}
else {$iphone = 0;}
if ($iphone == '1') { ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/iphone.css" type="text/css" media="screen" />
<?php } ?>

<!--BELOW STYLES ARE CONTROLLED FROM THE THEME OPTIONS PANEL-->
<style>
a {color: <?php echo $color;?>;}
<?php if($googleKeyword){?>body {font-family: '<?php echo $googleKeyword;?>', sans-serif;}<?php } ?>
<?php echo $css;?>
</style>
<!--ABOVE STYLES ARE CONTROLLED FROM THE THEME OPTIONS PANEL-->

<?php
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"), false, '');
wp_enqueue_script('jquery');
wp_head();
if ( is_singular() ) wp_enqueue_script( "comment-reply" );
?>

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
<![endif]-->

</head>

<body <?php body_class();?>>

<div id="loading"></div>

<div id="pageContent">

<!--TAB STUFF-->
<?php if(is_page() || is_single()){$args = array('post_type' => 'attachment','post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args);}?>
<ul id="navBox" <?php if(!is_page_template('page_gallery.php')){?>class="openNav"<?php }?>>
<!--MENU-->
<li id="homeNav"><a href="#homeBox" class="<?php if(is_front_page() && !is_page_template('page_gallery.php')){?>activeNav<?php }?>">MENU</a></li>
<!--INFO/LIST-->
<li id="contentNav">
<a href="#contentBox" class="<?php if(!is_front_page() && !is_page_template('page_gallery.php')){?>activeNav<?php }?>"><?php if(is_search() || is_archive() || is_home()){?>LIST<?php } else { ?>INFO<?php } ?></a>
</li>
<!--THUMBS-->
<?php if ($attachments) { ?>
<li id="galleryNav"><a href="#galleryBox">THUMBS</a></li>
<!--MORE-->
<?php } if ( is_dynamic_sidebar() ) { ?>
<li id="widgetNav"><a href="#widgetBox">MORE</a></li>
<?php } ?>
</ul>

<!--HOME BOX-->
<div id="homeBox" class="boxStuff<?php if(is_front_page() && !is_page_template('page_gallery.php')){?> activeBox<?php }?>">
<!--LOGO-->
<img id="logo" src="<?php echo $logo;?>" alt="<?php bloginfo('name'); ?>" /><!--end logo-->
<!--MENU-->
<?php if (has_nav_menu( 'main' ) ) { wp_nav_menu(array('theme_location' => 'main', 'container_id' => 'navigation', 'menu_id' => 'dropmenu')); }?>
<!--COPYRIGHT-->
<div id="copyright">
&copy; <?php echo date("Y "); bloginfo('name'); ?>. <?php echo $footerText;?>
</div>
</div><!--end homeBox-->

There is also footer, page, & functions php

lackex
02-17-2012, 08:25 PM
Header php:


<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="initial-scale=1.0,width=device-width" />
<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php
//OptionTree Stuff
if ( function_exists( 'get_option_tree') ) {
$theme_options = get_option('option_tree');
$light = get_option_tree('light',$theme_options);
$googleApi = get_option_tree('google_api',$theme_options);
$googleKeyword = get_option_tree('google_keyword',$theme_options);
$logo = get_option_tree('logo',$theme_options);
$footerText = get_option_tree('footer_text',$theme_options);
$color = get_option_tree('color',$theme_options);
$favicon = get_option_tree('favicon',$theme_options);
$css = get_option_tree('css',$theme_options);
}
?>

<?php if($favicon) { ?><link rel="icon" href="<?php echo $favicon; ?>" type="image/x-icon" /><?php } ?>

<?php if($googleApi) { echo $googleApi; } ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php if($light){?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/light.css" type="text/css" media="screen" />
<?php } ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/scripts/prettyPhoto.css" type="text/css" media="screen" />
<?php
//IF iPhone/iPod, LOAD iPhone CSS FILE
if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT'])) {$iphone = 1;}
elseif (ereg('iPod',$_SERVER['HTTP_USER_AGENT'])) {$iphone = 1;}
else {$iphone = 0;}
if ($iphone == '1') { ?>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/iphone.css" type="text/css" media="screen" />
<?php } ?>

<!--BELOW STYLES ARE CONTROLLED FROM THE THEME OPTIONS PANEL-->
<style>
a {color: <?php echo $color;?>;}
<?php if($googleKeyword){?>body {font-family: '<?php echo $googleKeyword;?>', sans-serif;}<?php } ?>
<?php echo $css;?>
</style>
<!--ABOVE STYLES ARE CONTROLLED FROM THE THEME OPTIONS PANEL-->

<?php
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"), false, '');
wp_enqueue_script('jquery');
wp_head();
if ( is_singular() ) wp_enqueue_script( "comment-reply" );
?>

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
<![endif]-->

</head>

<body <?php body_class();?>>

<div id="loading"></div>

<div id="pageContent">

<!--TAB STUFF-->
<?php if(is_page() || is_single()){$args = array('post_type' => 'attachment','post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args);}?>
<ul id="navBox" <?php if(!is_page_template('page_gallery.php')){?>class="openNav"<?php }?>>
<!--MENU-->
<li id="homeNav"><a href="#homeBox" class="<?php if(is_front_page() && !is_page_template('page_gallery.php')){?>activeNav<?php }?>">MENU</a></li>
<!--INFO/LIST-->
<li id="contentNav">
<a href="#contentBox" class="<?php if(!is_front_page() && !is_page_template('page_gallery.php')){?>activeNav<?php }?>"><?php if(is_search() || is_archive() || is_home()){?>LIST<?php } else { ?>INFO<?php } ?></a>
</li>
<!--THUMBS-->
<?php if ($attachments) { ?>
<li id="galleryNav"><a href="#galleryBox">THUMBS</a></li>
<!--MORE-->
<?php } if ( is_dynamic_sidebar() ) { ?>
<li id="widgetNav"><a href="#widgetBox">MORE</a></li>
<?php } ?>
</ul>

<!--HOME BOX-->
<div id="homeBox" class="boxStuff<?php if(is_front_page() && !is_page_template('page_gallery.php')){?> activeBox<?php }?>">
<!--LOGO-->
<img id="logo" src="<?php echo $logo;?>" alt="<?php bloginfo('name'); ?>" /><!--end logo-->
<!--MENU-->
<?php if (has_nav_menu( 'main' ) ) { wp_nav_menu(array('theme_location' => 'main', 'container_id' => 'navigation', 'menu_id' => 'dropmenu')); }?>
<!--COPYRIGHT-->
<div id="copyright">
&copy; <?php echo date("Y "); bloginfo('name'); ?>. <?php echo $footerText;?>
</div>
</div><!--end homeBox-->

Footer:


<div id="blogNav">
<?php if(is_single()){
previous_post_link('%link', '&rarr;', TRUE);
next_post_link('%link', '&larr;', TRUE);
} elseif(is_category() || is_search()){
next_posts_link('&rarr;');
previous_posts_link('&larr;');
}
if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs();?>
</div>

<div id="leftBg" class="bigBg"></div>
<div id="rightBg" class="bigBg"></div>

<div id="mesh"></div>

</div><!--end pageContent-->

<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/scripts/prettyphoto.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/scripts/backstretch.js"></script>
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/scripts/custom.js"></script>
<script>
jQuery.noConflict(); jQuery(document).ready(function(){

<?php
//DEFAULT BACKGROUND
if ( function_exists( 'get_option_tree') ) {
$background = get_option_tree('background',$theme_options);
}
//IF CUSTOM BACKGROUND
if(is_single() || is_page() || is_front_page()) {
$data = get_post_meta( $post->ID, 'key', true );
if ($data[ 'background' ]) {
$background = $data[ 'background' ];
}
//IF CATEGORY BACKGROUND
} elseif(is_category() && category_description()){
$background = category_description();
}
//IF NOT GALLERY PAGE
if(!is_page_template('page_gallery.php')){?>

//LOAD BACKGROUND
jQuery.backstretch("<?php echo $background;?>", {speed: 300});

<?php } ?>

});
</script>

<?php wp_footer(); ?>

</body>
</html>

Page:


<?php get_header(); ?>

<div id="contentBox" class="boxStuff<?php if(!is_front_page()){?> activeBox<?php }?>">

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<h2 class="entrytitle"><?php the_title(); ?></h2>
<div class="entry">
<?php the_content(); ?>
<br />
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<?php edit_post_link('Edit Page','<p id="metaStuff">','</p>'); ?>

<div class="clear"></div>
<?php endwhile; endif; ?>

<div id="commentsection">
<?php comments_template(); ?>
</div>

</div><!--end contentBox-->

<?php $args = array('post_type' => 'attachment','post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args);?>
<?php if ($attachments) { ?>
<div id="galleryBox" class="boxStuff">
<ul class="attachmentGallery">
<?php attachment_toolbox(); ?>
</ul>
</div>

<div id="bgControls">
<a href="#" id="nextImg">&rarr;</a>
<a href="#" id="prevImg">&larr;</a>
<div id="imgInfo"></div>
</div>
<?php } ?>

<?php
get_sidebar();
get_footer();
?>

Functions:


<?php

//OPTIONS PLUGIN CHECK
wpaid_check();
function wpaid_check()
{
if ( !function_exists('option_tree_css_save') )
{
add_thickbox(); // Required for the plugin install dialog.
add_action('admin_notices', 'wpaid_check_notice');
}
}
add_theme_support('automatic-feed-links' );
// The Admin Notice if OptionTree not installed.
function wpaid_check_notice()
{
?>
<div class='updated fade'>
<p>The OptionTree plugin is required for this theme to function properly. <a href="<?php echo admin_url('plugin-install.php?tab=plugin-information&plugin=option-tree&TB_iframe=true&width=640&height=517'); ?>" class="thickbox onclick">Install now</a>.</p>
</div>
<?php
}


add_theme_support('automatic-feed-links' );

if ( ! isset( $content_width ) ) $content_width = 420;

//REMOVE TAGS FROM CAT DESCRIPTION
remove_filter('term_description','wpautop');

//FEATURED IMAGE SUPPORT
add_theme_support( 'post-thumbnails', array( 'post' ) );
set_post_thumbnail_size( 420, 200, true );
add_image_size( 'gallery',420 ,9999 );

//CATEGORY ID FROM NAME FOR PAGE TEMPLATES
function get_category_id($cat_name){
$term = get_term_by('name', $cat_name, 'category');
return $term->term_id;
}

//EXCERPT STUFF
function new_excerpt_length($length) {
return 10;
}
add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_more($more) {
global $post;
return ' ...';
}
add_filter('excerpt_more', 'new_excerpt_more');

//IMAGE ATTACHMENTS TOOLBOX
function attachment_toolbox($size = full) {

if($images = get_children(array(
'order' => 'ASC',
'orderby' => 'menu_order',
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image'
))) {
foreach($images as $image) {
$attimg = wp_get_attachment_image($image->ID,$size);
$atturl = wp_get_attachment_url($image->ID);
$atttitle = apply_filters('the_title',$image->post_title);
echo'<li class="wrapperli"><a href="'.$atturl.'" title="'.$atttitle.'">'.$attimg.'</a></li>';
}
}
}


//ADD MENU SUPPORT
add_theme_support( 'menus' );
register_nav_menu('main', 'Main Navigation Menu');

//REPLACE FOOTER INFO
function remove_footer_admin () {
echo "Theme designed and developed by <a href='http://themeforest.net/user/themolitor/portfolio?ref=themolitor'>THE MOLITOR</a>";
}
add_filter('admin_footer_text', 'remove_footer_admin');

//BREADCRUMBS
function dimox_breadcrumbs() {
$delimiter = '&nbsp;/&nbsp;';
//$name = 'Home';
$name = get_bloginfo('name');
$currentBefore = '<span class="current">';
$currentAfter = '</span>';
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '<div id="crumbs">';
global $post;
$home = home_url();
echo '<a href="' . $home . '">' . $name . '</a> ' . $delimiter . ' ';
if ( is_category() ) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
echo $currentBefore . '';
single_cat_title();
echo '' . $currentAfter;
} elseif ( is_day() ) {
echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' ';
echo '<a href="' . get_month_link(get_the_time('Y'),get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $delimiter . ' ';
echo $currentBefore . get_the_time('d') . $currentAfter;
} elseif ( is_month() ) {
echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' ';
echo $currentBefore . get_the_time('F') . $currentAfter;
} elseif ( is_year() ) {
echo $currentBefore . get_the_time('Y') . $currentAfter;
} elseif ( is_single() && !is_attachment() ) {
$cat = get_the_category(); $cat = $cat[0];
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
echo $currentBefore;
//the_title();
echo "Current Page";
echo $currentAfter;
} elseif ( is_attachment() ) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a> ' . $delimiter . ' ';
echo $currentBefore;
the_title();
echo $currentAfter;
} elseif ( is_page() && !$post->post_parent ) {
echo $currentBefore;
the_title();
echo $currentAfter;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' ';
echo $currentBefore;
the_title();
echo $currentAfter;
} elseif ( is_search() ) {
echo $currentBefore . 'Search Results' . $currentAfter;
} elseif ( is_tag() ) {
echo $currentBefore . 'Posts tagged '';
single_tag_title();
echo ''' . $currentAfter;
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata($author);
echo $currentBefore . 'Articles posted by ' . $userdata->display_name . $currentAfter;
} elseif ( is_404() ) {
echo $currentBefore . 'Error 404' . $currentAfter;
}
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
echo __('Page') . ' ' . get_query_var('paged');
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
}
echo '</div>';
}
}

//SIDEBAR GENERATOR (FOR SIDEBAR AND FOOTER)-----------------------------------------------
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'Live Widgets',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));

//CUSOTM POST OPTIONS
$key = "key";

$meta_boxes = array(

"background" => array(
"name" => "background",
"title" => "Custom Background Image URL",
"description" => "")

);
function create_meta_box() {
global $key;
if( function_exists( 'add_meta_box' ) ) {
add_meta_box( 'new-meta-boxes', ' Custom Post Options', 'display_meta_box', 'post', 'normal', 'high' );
add_meta_box( 'new-meta-boxes', ' Custom Post Options', 'display_meta_box', 'page', 'normal', 'high' );
}
}
function display_meta_box() {
global $post, $meta_boxes, $key;
?>
<div class="form-wrap">
<?php wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );
foreach($meta_boxes as $meta_box) {
$data = get_post_meta($post->ID, $key, true);
?>
<div class="form-field form-required">
<label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?></label>
<input type="text" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php echo htmlspecialchars( $data[ $meta_box[ 'name' ] ] ); ?>" />
<p><?php echo $meta_box[ 'description' ]; ?></p>
</div>
<?php } ?>
</div>
<?php
}
function save_meta_box( $post_id ) {
global $post, $meta_boxes, $key;
foreach( $meta_boxes as $meta_box ) {
$data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];
}
if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )
return $post_id;
if ( !current_user_can( 'edit_post', $post_id ))
return $post_id;
update_post_meta( $post_id, $key, $data );
}
add_action( 'admin_menu', 'create_meta_box' );
add_action( 'save_post', 'save_meta_box' );
?>

lackex
02-17-2012, 08:26 PM
Sorry for posting so much code, I've been mulling over it for the last few days and its all very confusing to me! I'm going to keep looking for where it gets called in, though.

lackex
02-17-2012, 08:36 PM
Could it possibly be


<?php if(is_page() || is_single()){$args = array('post_type' => 'attachment','post_mime_type' => 'image' ,'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args);}?>
<ul id="navBox" <?php if(!is_page_template('page_gallery.php')){?>class="openNav"<?php }?>>
<!--MENU-->
<li id="homeNav"><a href="#homeBox" class="<?php if(is_front_page() && !is_page_template('page_gallery.php')){?>activeNav<?php }?>">MENU</a></li>

Where it says opennav, would that maybe be it? I tried changing it to closeNav but nothing happened.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum