Jump to content

bgbs

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by bgbs

  1. I have this javascript code that loads in the footer. I only need this javascript to load on a static home page, not on all other pages. <script type="text/javascript"> var banner = (function(){ $('.banner').unslider({ speed: 1000, // The speed to animate each slide (in milliseconds) delay: 999000, // The delay between slide animations (in milliseconds) complete: function() {}, // A function that gets called after every slide animation keys: false, // Enable keyboard (left, right) arrow shortcuts dots: false, // Display dot navigation fluid: true // Support responsive design. May break non-responsive designs }); $( '#nav li:has(ul)' ).doubleTapToGo(); }); </script> <script> jQuery(document).ready(function() { jQuery('.nav-toggle').click(function(){ //get collapse content selector var collapse_content_selector = jQuery(this).attr('href'); //make the collapse content to be shown or hide var toggle_switch = jQuery(this); jQuery(collapse_content_selector).toggle(function(){ if(jQuery(this).css('display')=='none'){ toggle_switch.html('View All Services');//change the button label to be 'Show' }else{ toggle_switch.html('Hide Services List');//change the button label to be 'Hide' } }); }); }); </script> <script> jQuery(document).ready(function() { jQuery('.navtop-toggle').click(function(){ //get collapse content selector var collapse_content_selector = jQuery(this).attr('href'); //make the collapse content to be shown or hide var toggle_switch = jQuery(this); jQuery(collapse_content_selector).toggle(function(){ if(jQuery(this).css('display')=='none'){ toggle_switch.html('Menu');//change the button label to be 'Show' }else{ toggle_switch.html('Hide Menu');//change the button label to be 'Hide' } }); }); }); </script> So far I have this php statement, but I'm having trouble wrapping it in this php code. <?php if ($page=="home") echo " "; ?> I'm not sure if putting the whole javascript code above is a good idea in the echo quotes. Is there an easier or better way of wrapping javascript in PHP? Your help appreciated.
  2. Ok, so Im using if else in WP <?php if ( is_home() ) { // This is a homepage } else { <!-- header image --> <div class="dynamic-header"><?php if(function_exists('show_media_header')){ show_media_header(); } ?></div> <!-- /header image --> } ?> What I'm trying to do is load dynamic header banner on other pages except for home page. But I know I can't call php within php, so how do I properly wrap the code after else statement? Thanks in advance
  3. You guys are an unbelievable support community. Thanks
  4. I have this code <?php if ( $page == "home" ) { echo '<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/expand.js"></script>';} ?> for $page, can I put several pages in the quotes where I currently list "home". If I can, how would I do this, because putting comma doesn't seem to work for me, although syntax error is not displayed. Thanks in advance
  5. Thanks a million, that answers it for me.
  6. I have a plugin that outputs username after login, I want it to display first name instead. Here is the code that does it. global $userdata,$user_identity; get_currentuserinfo(); if ($userdata->ID>0) { // User is logged in echo '<div class="login">' . $before_widget . $before_title . "Welcome ".$user_identity . $after_title . '</div>'; echo ' <ul class="login-links"> <li><a href="'.get_bloginfo('wpurl').'/wp-login.php?action=logout&redirect_to=http://'.$_SERVER["SERVER_NAME"].$_SERVER['REQUEST_URI'].'">Logout</a></li> <li><a href="'.get_bloginfo('wpurl').'/wp-admin">Dashboard</a></li> <li><a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php">Profile</a></li> </ul> '; } else { // User is NOT logged in!!! echo $before_widget . $before_title . '<div class="login">Welcome Guest, <a href="'.get_bloginfo('wpurl').'/wp-admin">Login</a></div>' . $after_title; $user_identity is what outputs that username. I searched through wordpress forums and someone said I have to add $current_user->first_name to the code. The question is, where and how do I add it? I assume I would need to add it to this line global $userdata,$user_identity; But how do I properly syntax that? I tried doing it myself like this global $userdata,$user_identity = $current_user->first_name; but I'm getting syntax errors Your help is highly appreciated.
  7. This way will not work because I'm already working within php. Another words the statement below is already contained in php brackets, so echoing php within php will not work. <?php case 'email': $html .= ' <input name="s" id="s" value="Email..." type="text" size="18" value="'.esc_html($var['default']).'" name="'.esc_attr($opt).'" id="'.esc_attr($opt).'" class="mc_input"/>'; break; ?>
  8. Hi I have this input box wrapped in php code case 'email': $html .= ' <input name="s" id="s" value="Email..." type="text" size="18" value="'.esc_html($var['default']).'" name="'.esc_attr($opt).'" id="'.esc_attr($opt).'" class="mc_input"/>'; break; And I would like to add this javascript into the input form onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';} So, the newb that I am, I tried this and got a syntax error <input name="s" id="s" onfocus="'.if (this.value == 'Search...') {this.value = '';}.'" onblur="'.if (this.value == '') {this.value = 'Search...';}.'" value="Email..." type="text" size="18" value="'.esc_html($var['default']).'" name="'.esc_attr($opt).'" id="'.esc_attr($opt).'" class="mc_input"/>'; Any ideas how to properly integrate this javascript code into PHP? Thanks in advance
  9. That worked! But wait, why did you have to break this to two separate echo statements? Why couldn't this be wrapped all in one echo? Thanks for your help Ben
  10. It is a huge php file with pages of code wrapped in php tags. And in between those tags, I'm just trying to add a statement to output an image from images folder, and instead of echoing full url path, I'm using the wordpresses path to template folder, and how to do this properly in echo is where I'm stock right now. But as I posted above here is what I've been able to do echo '<img src="'. bloginfo('template_directory') .'/images/image.png" title="" alt="" />'; But it outputs, when viewing html source, as: http://site.com/wp-content/themes/mytheme <img alt="" title="" src="/images/image.png">
  11. This will not work, because the whole echo statement needs to be wrapped in php tags. I just tried this and it is working half way echo '<img src="'. bloginfo('template_directory') .'/images/image.png" title="" alt="" />'; But it outputs, when viewing html source, as: http://site.com/wp-content/themes/mytheme <img alt="" title="" src="/images/image.png">
  12. You mean like this? <?php echo '<img src="bloginfo('template_directory')/images/image.png" title="" alt="" />'; ?> This doesnt work
  13. This is used by wordpress, but I know Im not properly wrapping it in echo statement
  14. I need to rewrite this php statement <img src="<?php bloginfo('template_directory'); ?>/images/mainimage.jpg" title="" alt="" /> When I try to do this <?php echo '<img src="<?php bloginfo('template_directory'); ?>/images/mainimage.jpg" title="" alt="" />' ; ?> It does not work, because I guess I've open and closed a php code inside php. How do I properly write this statement? Thanks Ben
  15. How do I correctly display image? <div class="nav-right"><?php next_posts_link('<img src="images/more-but.png" />') ?></div> I must be writing it incorrectly. Thanks in advance
  16. Yes, removing extra closing fixed it. Thanks guys
  17. Dreamweaver is telling me there is a syntax error right below the </ul></div> menu <?php } I know this is happening because I'm doing something with the header title located between <h3></h3> Full code below, please help <div id="sidebar"> <?php if($post->post_parent) $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0"); if ($children) { ?> <div class="small_box widget_pages"> <h3><a href="<?php echo $permalink; ?>" title="< ?php echo $parent_title; ?>"><?php echo $parent_title; ?></a></h3> <?php } else { ?> <h3><a href="<?php echo get_permalink(); ?>" title="< ?php echo $parent_title; ?>"><?php the_title(); ?></a></h3> <?php } ?> <ul> <?php echo $children; ?> </ul> </div> <?php } if (is_page()){ #sidebar used for pages if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Pages') ) : kriesi_small_description($themeurl); else: ?> <?php kriesi_small_description($themeurl); kriesi_small_description2($themeurl); ?> <div class="widget"> <?php /*?> <?php get_search_form(); ?><?php */?> </div> <?php endif; }else{ #sidebar used for blog & archives (category, tag, date, etc) if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Blog') ) : kriesi_small_description($themeurl); else: ?> <?php kriesi_small_description($themeurl); kriesi_small_description3($themeurl); kriesi_small_description2($themeurl); ?> <div class="widget small_box"> <?php get_search_form(); ?> </div> <?php endif; } if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Everywhere') ) : endif;?> </div><!-- end sidebar -->
  18. I wonder if there is a php character recognition software out there that can be integrated into a site. I have a site where I import loads amount of emails through an automated processes. The emails then get posted on the website. The problem is, some emails contain a big image ad as part of the body so the text becomes unsearchable because it is contained in the image. So I'm in need of a software that could read the text in the image that can also be displayed in the email or applied to keyword tags. Is there a PHP OCR software out there?
  19. I was thinking in the beginning to store values in the php file for now, and then upgrade to the database later. I'm very new to php and I dont want to go over my head with this php construction. I'm trying to take it one step at a time to master php capabilities. Thanks
  20. my header file contains the <head> but I would like to have different meta tags displayed depending on the page being displayed. I know you could insert <head> into each file and be done with it, but that may drive me nuts as the site grows. So I'm trying to see how I can do it differently So far I can do this with php <?php $meta_title="Site title goes here"; $meta_heading="Site heading info goes here"; $meta_desc="Site Description goes here"; $meta_keys="Site, Key, Words, Go, Here"; ?> Then I can call that meta tag by inserting this in the pages <meta name="description" content="<?php echo $meta_desc ?>" /> I also have $page=" unique page name" inserted in each page. I know this php meta script is incomplete, but what can I do to take it to the next level? Do I need to use and if statements, and how would I? Thanks for all your help -Ben
  21. Sounds like a plan, do you know any good simple ones? Thanks
  22. Hi, I never done something like this, therefore I'm looking for some information, maybe a tutorial how to create a simple store and retrieve database script. Basically I would need to design a form to store content into database. I need to store simple content -- category, title, description, and author. I would need to create database tables, and retrieve that data. Any help on this subject is appreciative. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.