Loop is inside footer somehow. Wordpress theme development - php

I have a 1px border assigned to my footer on my wordpress theme, which worked well, but somewhere along the line, that border appeared at the top of my loop. I'm not sure if I have a missing end div somewhere, or what I did, but it's driving me nuts!
Here is my header.php file.
<DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo(charset); ?>">
<meta name="viewport" content="width=device-width">
<title><?php bloginfo('name'); ?></title>
<link href="https://fonts.googleapis.com/css?family=Abel|Dosis|Exo|Galada|Muli|Old+Standard+TT|Open+Sans+Condensed:300|Rajdhani|Raleway|Shrikhand|Bad+Script|Cinzel+Decorative|Allan" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<!-- Site Header -->
<header class="site-header">
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn"><i class="fa fa-cog"></i></button>
<div id="myDropdown" class="dropdown-content">
<?php wp_nav_menu (array('theme_location' => 'primary')); ?>
</div>
</div>
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</header>
<!-- /Site Header -->
Here is my index.php file, which contains the loop.
<div class="homepage-banner">
<div class="homepage-banner__bg-image" style="background-image: url(<?php echo get_theme_file_uri('/images/header3.png') ?>);">
</div>
<div class="homepage-banner__content">
<div class="headline-large">acetronaut</div>
<div class="headline-mid">fashion. beauty. lifestyle. adventure</div>
</div>
<div class="arrow"><i class="fa fa-angle-double-down"></i>
</div>
</div>
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) :
while (have_posts()) : the_post(); ?>
<div class="acetronaut-half">
<div class="acetronaut-post" style="background-image:url(<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>);">
<div class="acetronaut-post-content">
<h2 class="acetrnt-post-category"><?php the_category(); ?></h2>
<h2 class="blog-title"><?php the_title(); ?></h2>
<p><?php echo get_the_excerpt(''); ?><a href="<?php the_permalink(); ?>">Continue Reading ยป</p>
</div>
</div>
</div>
<?php endwhile;
else :
echo '<p>No content Found</p>';
endif;
get_footer();
?>
</div>
And here is my footer.php file.
<footer class="site-footer">
<?php
$args = array('theme_location' => 'footer')
?>
<nav class="site-nav"><?php wp_nav_menu( $args ); ?></nav>
<p><?php bloginfo('name'); ?> >> ยฉ <?php echo date('Y'); ?></p>
</footer>
<?php wp_footer(); ?>
</body>
</html>
If anyone can find where the problem might be, I would greatly appreciate it.

Related

Wordpress theme crashes when updating header.php on the Editor

I am currently working on a website I didn't code in the first place. It was created by someone else on Wordpress using the Sidney Theme and there is no child-theme.
Here is my problem : when I update the header.php file by going to Appearance -> Editor, the website crashes and all the CSS disappears.
Fortunalely, I made a backup of the website so I recovered it.
I never had any problem like this one. It is the first time I post on Stack Overflow so if you need any info just tell me.
The website is under version 5.1.1 of Wordpress.
Here is header.php file if it can help :
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div
id="content">
*
* #package Sydney
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon()
) : ?>
<?php if ( get_theme_mod('site_favicon') ) : ?>
<link rel="shortcut icon" href="<?php echo
esc_url(get_theme_mod('site_favicon')); ?>" />
<?php endif; ?>
<?php endif; ?>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php do_action('sydney_before_site'); //Hooked: sydney_preloader() ?>
<div id="page" class="hfeed site">
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'sydney' ); ?></a>
<?php do_action('sydney_before_header'); //Hooked: sydney_header_clone() ?>
<header id="masthead" class="site-header" role="banner">
<div class="header-wrap">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-8 col-xs-12">
<?php if ( get_theme_mod('site_logo') ) : ?>
<img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" />
<?php else : ?>
<h1 class="site-title"><?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
<?php endif; ?>
</div>
<div class="col-md-8 col-sm-4 col-xs-12">
<div class="btn-menu"></div>
<nav id="mainnav" class="mainnav" role="navigation">
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'fallback_cb' => 'sydney_menu_fallback' ) ); ?>
</nav><!-- #site-navigation -->
</div>
</div>
</div>
</div>
</header><!-- #masthead -->
<?php do_action('sydney_after_header'); ?>
<div class="sydney-hero-area">
<?php sydney_slider_template(); ?>
<div class="header-image">
<?php sydney_header_overlay(); ?>
<img class="header-inner" src="<?php header_image(); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>">
</div>
<?php sydney_header_video(); ?>
<?php do_action('sydney_inside_hero'); ?>
</div>
<?php do_action('sydney_after_hero'); ?>
<div id="content" class="page-wrap">
<div class="container content-wrapper">
<div class="row">
don't use theme Editor. open your cpanel. go to your theme folder. edit your header file. then paste your code.
thankyou.

Centering an objekt in php template. How?

I have a little problem with aligning a logo with some text in wordpress.
The more transparent logo is where I want my logo to be. It is in my header.php in my wordpress theme "Creator World".
I Really dont know what to do I have tried to research and I couldn't find anything. Hope you can help me ๐Ÿ˜€
The more transparent logo and the arrow is sat in, in an design app
Here is my php code for my header.php in wordpress
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div class="container">
*
* #package Creator World
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="pagewrap">
<div class="headertop">
<div class="container">
<?php if ( ! dynamic_sidebar( 'header-info' ) ) : ?>
<?php endif; // end header widget area ?>
</div><!-- .container -->
</div><!-- .headertop -->
<div class="header">
<div class="container">
<div class="logo">
<?php creator_world_the_custom_logo(); ?>
<h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php bloginfo('name'); ?>
</a></h1>
<p>
<?php bloginfo('description'); ?>
</p>
</div><!-- logo -->
<div class="toggle"> <a class="toggleMenu" href="#">
<?php _e('Menu','creator-world'); ?>
</a> </div> <!-- toggle -->
<div class="sitenav">
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
</div>
<!-- site-nav -->
<div class="clear"></div>
</div><!-- container -->
</div><!--.header -->
<?php if ( is_front_page() && !is_home() ) { ?>
<?php $hideslide = get_theme_mod('disabled_slides', '1'); ?>
<?php if($hideslide == ''){ ?>
<?php for($sld=7; $sld<10; $sld++) { ?>
<?php if( get_theme_mod('page-setting'.$sld)) { ?>
<?php $slidequery = new WP_query('page_id='.get_theme_mod('page-setting'.$sld,true)); ?>
<?php while( $slidequery->have_posts() ) : $slidequery->the_post();
$image = wp_get_attachment_url( get_post_thumbnail_id($post->ID));
$img_arr[] = $image;
$id_arr[] = $post->ID;
endwhile;
}
}
?>
<?php if(!empty($id_arr)){ ?>
<div id="slider" class="nivoSlider">
<?php
$i=1;
foreach($img_arr as $url){ ?>
<?php if(!empty($url)){ ?>
<img src="<?php echo $url; ?>" title="#slidecaption<?php echo $i; ?>" />
<?php }else{ ?>
<img src="<?php echo esc_url( get_template_directory_uri() ) ; ?>/images/slides/slider-default.jpg" title="#slidecaption<?php echo $i; ?>" />
<?php } ?>
<?php $i++; } ?>
</div>
<?php
$i=1;
foreach($id_arr as $id){
$title = get_the_title( $id );
$post = get_post($id);
$content = esc_html( wp_trim_words( $post->post_content, 20, '' ) );
?>
<div id="slidecaption<?php echo $i; ?>" class="nivo-html-caption">
<div class="slide_info">
<h2><?php echo $title; ?></h2>
<p><?php echo $content; ?></p>
</div>
</div>
<?php $i++; } ?>
<?php wp_reset_postdata(); ?>
<div class="clear"></div>
<?php } ?>
<?php } } ?>
<?php if ( is_front_page() && ! is_home() ) { ?>
<?php $hidewelcome = get_theme_mod('disabled_welcome', '1'); ?>
<?php if($hidewelcome == ''){ ?>
<section id="welcomesection">
<div class="container">
<div class="welcomebx">
<?php if( get_theme_mod('page-setting1')) { ?>
<?php $queryvar = new WP_query('page_id='.get_theme_mod('page-setting1' ,true)); ?>
<?php while( $queryvar->have_posts() ) : $queryvar->the_post();?>
<h2 class="headingtitle">
<?php the_title(); ?>
</h2>
<?php the_content(); ?>
<div class="clear"></div>
<?php endwhile;
wp_reset_postdata(); ?>
<?php } ?>
</div> <!-- welcomewrap-->
<div class="clear"></div>
</div> <!-- container -->
</section>
<?php } ?>
<?php $hidepgbxes = get_theme_mod('disabled_pageboxes', '1'); ?>
<?php if($hidepgbxes == ''){ ?>
<section id="wrapsecond">
<div class="container">
<div class="services-wrap">
<?php for($p=1; $p<5; $p++) { ?>
<?php if( get_theme_mod('page-column'.$p,false)) { ?>
<?php $querymy = new WP_query('page_id='.get_theme_mod('page-column'.$p,true)); ?>
<?php while( $querymy->have_posts() ) : $querymy->the_post(); ?>
<div class="fourbox <?php if($p % 4 == 0) { echo "last_column"; } ?>">
<?php if(has_post_thumbnail() ) { ?>
<div class="thumbbx"><?php the_post_thumbnail();?> </div>
<?php } ?>
<div class="pagecontent">
<h3><?php the_title(); ?></h3>
<p><?php echo wp_trim_words( get_the_content(), 20, '...' ); ?></p>
<a class="pagemore" href="<?php the_permalink(); ?>">
<?php _e('Read More','creator-world'); ?>
</a>
</div>
</div>
<?php endwhile;
wp_reset_postdata(); ?>
<?php } } ?>
<div class="clear"></div>
</div> <!-- services-wrap-->
</div> <!-- container -->
</section>
<?php } ?>
<?php } ?>
You can't center a logo through php. The right way will be css. Search by css and you will find many ways to achieve this. Or post the link of your site so that we can help you.
Try changing the code to the following, adding a new div with class brand-name and leaving only the logo in the one with logo class.
<div class="header">
<div class="container">
<div class="brand-name">
<h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php bloginfo('name'); ?>
</a></h1>
<p>
<?php bloginfo('description'); ?>
</p>
</div>
<div class="logo">
<?php creator_world_the_custom_logo(); ?>
</div><!-- logo -->
<div class="toggle"> <a class="toggleMenu" href="#">
<?php _e('Menu','creator-world'); ?>
</a> </div> <!-- toggle -->
<div class="sitenav">
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
</div>
<!-- site-nav -->
<div class="clear"></div>
</div><!-- container -->
</div><!--.header -->
Then, add the following lines in CSS:
.brand-name, .logo {
display: inline-block;
}
try wrapping the logo and title to the individual div elements
<div class="header">
<div class="container">
<div class="brand-title pull-left">
<h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>">
<?php bloginfo('name'); ?>
</a></h1>
<p>
<?php bloginfo('description'); ?>
</p>
</div><!-- Brand Title -->
<div class="brand-logo pull-left">
<?php creator_world_the_custom_logo(); ?>
</div><!-- Brand logo -->
<div class="toggle"> <a class="toggleMenu" href="#">
<?php _e('Menu','creator-world'); ?>
</a> </div> <!-- toggle -->
<div class="sitenav">
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
</div>
<!-- site-nav -->
<div class="clear"></div>
</div><!-- container -->
</div><!--.header -->
and then add the following code to your CSS file (usually this is style.css)
.pull-left {
float: left;
}

Change order by date on category wordpress

I need help with a product category page in Wordpress. Original code was made by someone else, and I'm fairly new to php. I may need help with looking for a way to make the product sort by date published. right now, here is the code that I have.
category-books.php
<?php
/**
* Template Name: Store Template
* #package WordPress
*/
get_header(); ?>
<div id="page-title">
<!-- 960 Container Start -->
<div class="container">
<div class="sixteen columns">
<h1>
<?php single_cat_title( '', true ); ?>
</h1>
</div>
</div>
<!-- 960 Container End -->
</div>
<?php
get_template_part( 'content', 'product4' ); ?>
<div class="blogsidebar" style="float:left !important">
<?php dynamic_sidebar('sidebar-1'); ?>
</div>
<?php get_footer(); ?>
content-product4.php
<?php function bac_wp_strip_header_tags_only( $excerpt ) {
$regex = '#(<h([1-6])[^>]*>)#';
$excerpt = preg_replace($regex,'', $excerpt);
return $excerpt;
}
add_filter( 'the_content', 'bac_wp_strip_header_tags_only', 0); ?>
<div class="container">
<?php $sidebar_side = get_post_meta($post->ID, 'incr_sidebar_layout', true);
if($sidebar_side == "left-sidebar") {
get_sidebar();
} ?>
<!-- Blog Posts ================================================== -->
<div class="twelve columns" style="float:right !important;">
<div class="product-container">
<?php $posts = query_posts($query_string . 'orderby=date&order=DESC&cat=238'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Post -->
<div <?php post_class('post'); ?> id="product-post-2Col" > <a class="post_title" href="<?php the_permalink() ?>">
<div style="margin-bottom:10px;width: 130px;height: 180px !important; border: 2px solid #000 !important;padding: 3px;float: left;margin: 0 15px 15px 0;overlay:hidden;">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail( 'medium', array( 'class' => 'store-featured-image' ) );
} else { ?>
<img src="<?php bloginfo('template_directory'); ?>/images/product-image.png" alt="<?php the_title(); ?>" />
<?php } ?>
</div>
<div style="min-height:40px !important;width:50% !important;float:left;">
<h4>
<?php the_title(); ?>
</h4>
</a> </div>
<?php?>
<div class="product-description-2col">
<?php the_excerpt()?>
<a style="margin-bottom: 8px;" class="post_title" href="<?php the_permalink() ?>">Learn More</a><br/>
<?php ?>
<a href="<?php the_field('buy_now_1')?>">
<div id="buybtn">Buy Now</div>
</a>
<?php ?>
</div>
<?php ?>
<p> </p>
<p> </p>
</div>
<!-- Post -->
<?php endwhile; // End the loop. Whew. ?>
</div>
<div style="text-align:center;">
<?php posts_nav_link( ' ยท ', 'previous page', 'next page' ); ?>
</div>
</div>
<!-- eof eleven column -->
is there a way to add something to functions.php? I've added this line but still not working:
<?php $posts = query_posts($query_string . 'orderby=date&order=DESC&cat=238'); ?>
<?php while (have_posts()) : the_post(); ?>
Thanks for the help.
Instead of using functions.php for this, create a child theme and edit a copy of the file you want to change there.
https://codex.wordpress.org/Child_Themes

why my post title replaces my page title [duplicate]

This question already has answers here:
why do my recent post titles replace the page title i am posting on [closed]
(2 answers)
Closed 9 years ago.
Hi guys i posted a question earlier about how my blog posts kept replacing my page titles in wordpress
https://stackoverflow.com/questions/20541544/why-do-my-recent-post-titles-replace-the-page-title-i-am-posting-on/20542610?noredirect=1#20542610
but i did not understand the way my questions were answered as i have no php experience so i thought id post my code here so if anyone could pin point were in the wordpress code it has a fault ?
this is the code for the page in which its title "Latest News" is being replaced
<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the wordpress construct of pages
* and that other 'pages' on your wordpress site will use a
* different template.
*
*/
?>
<?php get_header(); ?>
<div class="page-heading">
<h1 class="page-title"><?php the_title(); ?></h1>
<div class="clear"></div>
</div>
<!--Start Page Content -->
<div class="page-content-container">
<div class="page-content">
<div class="grid_16 alpha">
<div class="content-bar">
<?php if (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<div class="clear"></div>
<?php wp_link_pages(array('before' => '<div class="page-link"><span>' . __('Pages:', 'black-bird') . '</span>', 'after' => '</div>')); ?>
<?php endif; ?>
<!--Start Comment box-->
<?php comments_template(); ?>
<!--End Comment box-->
</div>
</div>
<div class="grid_8 omega">
<!--Start Sidebar-->
<?php get_sidebar(); ?>
<!--End Sidebar-->
</div>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
and this is the code for the posts of which each new post title replaces the page title
<?php
/**
* The Template for displaying all single posts.
*
*/
?>
<?php get_header(); ?>
<!--Start Page Heading-->
<!--Start Page Content -->
<div class="page-content-container">
<div class="page-content single">
<div class="grid_16 alpha">
<div class="content-bar">
<!-- Start the Loop. -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!--post start-->
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post_content">
<?php the_content(); ?>
<div class="clear"></div>
<h1 class="post_title single" ><span><?php the_title(); ?><span></h1>
<?php wp_link_pages(array('before' => '<div class="page-link"><span>' . __('Pages:', 'black-bird') . '</span>', 'after' => '</div>')); ?>
<?php if (has_tag()) { ?>
<div class="tag">
<?php the_tags(__('Post Tagged with ', ', ', '')); ?>
</div>
<?php } ?>
</div>
<ul class="post_meta clearfix">
<li class="posted_by"><span><?php _e('Posted by', 'black-bird'); ?></span> <img src="<?php echo get_template_directory_uri(); ?>/images/admin.png" /><?php the_author_posts_link(); ?></li>
<li class="post_category"><span><?php _e('Posted in', 'black-bird'); ?></span> <?php the_category(', '); ?></li>
<li class="post_date"><img src="<?php echo get_template_directory_uri(); ?>/images/date.png" /> <?php echo get_the_time('M, d, Y') ?></li>
<li class="post_comment"><img src="<?php echo get_template_directory_uri(); ?>/images/comment.png" /> <span><?php comments_popup_link('No Comments.', '1 Comment.', '% Comments.'); ?></span></li>
</ul>
</div>
<!--End Post-->
<?php
endwhile;
else:
?>
<div class="post">
<p>
<?php _e('Sorry, no posts matched your criteria.', 'black-bird'); ?>
</p>
</div>
<?php endif; ?>
<!--End Loop-->
<nav id="nav-single"> <span class="nav-previous">
<?php previous_post_link('%link', __('<span class="meta-nav">โ†</span> Previous Post ', 'black-bird')); ?>
</span> <span class="nav-next">
<?php next_post_link('%link', __('Next Post <span class="meta-nav">โ†’</span>', 'black-bird')); ?>
</span> </nav>
<!--Start Comment box-->
<?php comments_template(); ?>
<!--End Comment box-->
</div>
</div>
<div class="grid_8 omega">
<!--Start sidebar-->
<?php get_sidebar(); ?>
<!--End sidebar-->
</div>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
also this is the code for the header file
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title><?php wp_title(''); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?> style="<?php if (blackbird_get_option('blackbird_bodybg') != '') { ?>background: fixed url(<?php echo blackbird_get_option('blackbird_bodybg'); ?>);<?php } else {
?> background: fixed url(<?php echo get_template_directory_uri(); ?>/images/bg.jpg); <?php } ?>" >
<div class="main-container">
<div class="container_24">
<div class="grid_24">
<div class="header">
<div class="grid_16 alpha">
<div class="logo"> <img src="<?php if (blackbird_get_option('blackbird_logo') != '') { ?><?php echo blackbird_get_option('blackbird_logo'); ?><?php } else { ?><?php echo get_template_directory_uri(); ?>/images/logo.png<?php } ?>" alt="<?php bloginfo('name'); ?>" /></div>
</div>
<div class="grid_8 omega">
<div class="header-info">
<?php if (blackbird_get_option('blackbird_topright_cell') != '') { ?>
<p class="cell"><img src="<?php echo get_template_directory_uri(); ?>/images/call-us.png" class="call-us" /> <?php echo stripslashes(blackbird_get_option('blackbird_topright_cell')); ?></p>
<?php } else { ?>
<p class="cell"><img src="<?php echo get_template_directory_uri(); ?>/images/call-us.png" class="call-us" /> Call Us (111) 234 - 5678</p>
<?php } ?>
<?php if (blackbird_get_option('blackbird_topright_text') != '') { ?>
<p><?php echo stripslashes(blackbird_get_option('blackbird_topright_text')); ?></p>
<?php } else { ?>
<p><?php _e('21/B, London Campus, British Road, Birmingham, UK','black-bird'); ?></p>
<?php } ?>
</div>
</div>
</div>
<div class="clear"></div>
<!--start Menu wrapper-->
<div class="menu_wrapper">
<div class="grid_18 alpha">
<div id="MainNav">
<?php _e('Pages Navigation Menu','black-bird'); ?><span></span>
<?php blackbird_nav(); ?>
</div></div>
<div class="grid_6 omega">
<div class="top-search">
<?php get_search_form(); ?>
</div>
</div>
</div>
<!--End Menu wrapper-->
<div class="clear"></div>
so guys what do I need to alter and were in order for each post title to stop replacing the page title?
This bit of code:
<h1 class="post_title single"
Will print whatever the post title is. YOu can try replacing it with
<h1><?php wp_title(''); ?></h1>
To get the page title, or with
$parent_title = get_the_title($post->post_parent);
echo '<h1>' . $parent_title . '</h1>';
To get the parent page title

Hover on specific post should show the title of only that post

I'm using Wordpress for my website. What I'm trying to achieve is that if I hover on a specific post, it should show the title of that very post. But what it does right now, is that if I hover on one post, it displays the title of all the posts.
The code:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<div>
<div class="post-header"><a href="<?php the_permalink() ?>">
<?php if ( p75HasThumbnail($post->ID) ) { ?>
<img src="<?php echo p75GetThumbnail($post->ID, 200, 108); ?>" alt="<?php the_title(); ?>" width="200" height="108" />
<?php } ?>
</a></div>
<div class="post-content" style="display:none;">
<h2><?php the_title(); ?></h2>
</div>
<div class="post-footer">
<small>
In: <?php the_category(' | ') ?>
</small>
</div>
</div>
</div>
<!-- -->
<?php endwhile; ?>
<?php next_posts_link('<div class="post archiveTitle "><div>โ† Older</div></div>') ?>
<?php previous_posts_link('<div class="post archiveTitle "><div>Newer โ†’</div></div>') ?>
<?php else : ?>
<div class="post">
<div>
<h1>Not Found</h1>
<p>Sorry, but you are looking for something that isn't here.</p>
</div>
</div>
<?php endif; ?>
JS:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('.post-header').hover(function(){
$('.post-content').show();
}, function(){
$('.post-content').hide();
});
});
</script>
I'm not sure, if it's this, what you want to achieve:
$('.post-header').hover(function(){
$('.post-content', $(this).parent()).show();
}, function(){
$('.post-content').hide();
});
Now only the post-content of the currently hovered post is shown.

Categories