Centering an objekt in php template. How? - php

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;
}

Related

Loop is inside footer somehow. Wordpress theme development

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.

How Do I Add More Latest Post To Homepage

I can work pretty good with CSS and HTML but know nothing about PHP. I'm working on a wordpress client project and he wants more than one Latest Post/Recent Post to display on the static homepage. I'm pulling my hair out trying to figure this out. From the posted code, can someone show me what to delete and what to replace it with to make 5 of the most latest post appear? I really appreciate everyone's help.
<?php
/**
* Template Name: Homepage
*/
?>
<?php $mts_options = get_option(MTS_THEME_NAME); ?>
<?php get_header(); ?>
<?php if ($mts_options['mts_banner_show'] == '1') { ?>
<div class="b_first">
<div class="main-container">
<div class="container">
<div class="blog_first">
<!--first content-->
<div id="first_b">
<div class="b_right" <?php if ( isset( $_GET['mailchimp_signup'] ) || !empty( $_GET['aweber_signedup'] ) ) echo 'style="display:none;"'; ?>>
<h2 class="front-view-title">
<?php echo $mts_options['mts_banner_title']; ?>
</h2>
<div class="front-view-content">
<?php echo $mts_options['mts_banner_texts']; ?>
</div>
<?php if(!empty($mts_options['mts_button_text'])) { ?>
<div class="readMore" style="background:<?php echo $mts_options['mts_banner_button_bg']; ?>">
<?php echo $mts_options['mts_button_text']; ?>
<?php if(!empty($mts_options['mts_arrow_image'])) { ?>
<div class="b_dollor">
<img src="<?php echo $mts_options['mts_arrow_image']; ?>">
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<!--Rightside Content-Option-1-->
</div>
<div id="second_b" <?php if ( !isset( $_GET['mailchimp_signup'] ) && empty( $_GET['aweber_signedup'] ) ) echo 'style="display:none;"'; ?>>
<div class="blog_first_alternative">
<h2 class="front-view-title">
<?php echo $mts_options['mts_banner_title']; ?>
</h2>
<div class="form_wrap">
<?php if(!empty($mts_options['mts_form_image'])) { ?>
<div class="form_wrap_left">
<img src="<?php echo $mts_options['mts_form_image']; ?>">
</div>
<?php } ?>
<div class="form_wrap_right">
<?php dynamic_sidebar('Home Subscribe Widget'); ?>
</div>
</div>
</div>
<!--Rightside content alternative option-->
<script type="text/javascript">
function hide_b() {
jQuery('#first_b').hide();
jQuery('#second_b').show();
}
</script>
</div>
</div>
<!--End of first content-->
</div>
</div>
</div>
<?php } ?>
<div class="main-container">
<div id="page">
<div class="artcl article">
<div id="content_box">
<?php if ($mts_options['mts_banner2_show'] == '1') { ?>
<!--Second Content-->
<div class="blog_second">
<div class="b_left">
<h2 class="front-view-title">
<?php echo $mts_options['mts_social_title']; ?>
</h2>
<?php if ( !empty($mts_options['mts_banner_social']) && is_array($mts_options['mts_banner_social'])) { ?>
<div class="social-icons">
<ul>
<?php foreach( $mts_options['mts_banner_social'] as $header_icons ) : ?>
<?php if( ! empty( $header_icons['mts_banner_icon'] ) && isset( $header_icons['mts_banner_icon'] ) ) : ?>
<li><span class="fa fa-<?php print $header_icons['mts_banner_icon'] ?>"></span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php } ?>
</div>
<div class="b_right">
<h2 class="front-view-title">
<?php echo $mts_options['mts_books_title']; ?>
</h2>
<div class="b_readings">
<ul>
<?php if(!empty($mts_options['mts_books_image'])){ ?>
<?php foreach( $mts_options['mts_books_image'] as $slide ) : ?>
<li> <?php echo wp_get_attachment_image( $slide['mts_book_image'], false, array('title' =>'') ); ?></li>
<?php endforeach; ?>
<li class="more-books"><?php echo $mts_options['mts_more_book_text']; ?><i class="fa fa-angle-double-right"></i></li>
<?php } ?>
</ul>
</div>
</div>
</div>
<?php } ?>
<?php if(!empty($mts_options['mts_featured_posts']) && !empty($mts_options['mts_featured_post_cat'])) { ?>
<div class="home_article">
<?php
$featured_cat = implode( ",", $mts_options['mts_featured_post_cat'] );
$featured_query = new WP_Query('cat='.$featured_cat.'&posts_per_page=5');
if ($featured_query->have_posts()) : while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?>
<article class="latestPost featuredpost excerpt">
<!--Featured Post-->
<header>
<h3 class="title front-view-title"><?php echo get_the_category_by_ID($featured_cat); ?></h3>
<?php if(has_post_thumbnail()) { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" id="featured-thumbnail">
<div class="featured-thumbnail">
<?php the_post_thumbnail('steadyincome-featured',array('title' => '')); ?> <?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</div>
</a>
<?php } ?>
</header>
<div class="latestpost_wrap">
<h2 class="front-view-title">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>
"><?php the_title(); ?></a>
</h2>
<?php mts_the_postinfo( 'home' ); ?>
<div class="front-view-content">
<?php echo mts_excerpt(45); ?>
</div>
<?php mts_readmore(); ?>
</div>
</article>
<?php endwhile; wp_reset_query(); endif; ?>
<?php $j = 0;
if (get_query_var('page') > 1) {
$paged = get_query_var('page');
} elseif (get_query_var('paged')) {
$paged = get_query_var('paged');
} else {
$paged = 1;
}
$args= array('paged' => $paged, 'post_type' => 'post');
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post();?>
<?php if($j ==0){ ?>
<article class="latestPost latestpost excerpt">
<!--Latest Post-->
<header>
<h3 class="title front-view-title"><?php _e('Latest Post','steadyincome'); ?></h3>
<a href="<?php the_permalink() ?>" title="Menu widget article" id="featured-thumbnail">
<div class="featured-thumbnail">
<?php the_post_thumbnail('steadyincome-featured',array('title' => '')); ?>
<?php if (function_exists('wp_review_show_total')) wp_review_show_total(true, 'latestPost-review-wrapper'); ?>
</div>
</a>
</header>
<div class="latestpost_wrap">
<h2 class="front-view-title">
<?php the_title(); ?>
</h2>
<?php mts_the_postinfo( 'home' ); ?>
<div class="front-view-content">
<?php echo mts_excerpt(40); ?>
</div>
<?php mts_readmore(); ?>
</div>
</article>
<?php } ?>
<?php $j++; endwhile; wp_reset_query(); endif; ?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
Looks like you might have some setting in your theme settings. However if you have no setting there.
You can see this line that is limiting latest posts to just one Post:
<?php if($j ==0){ ?>
You may try to change it to number you want to try and see if it loops more posts there:
<?php if($j < 5){ ?>
This should allow the loop to run for five posts now. Give it a try and see if it helps.

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

Archive pages not working (WordPress)

I'm having some problems with my archives pages. See: the page loads (as you can see at the Title) here: http://plugcitarios.com/category/eventos/ and here http://plugcitarios.com/category/entretenimento/ but the content/posts is the same at every category I select.
This is the header.php
<!DOCTYPE html>
<html lang="<?php bloginfo('language'); ?>">
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php wp_title(''); ?></title>
<link href="<?php echo get_template_directory_uri(""); ?>/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<header class="full-width">
<div class="container">
<div class="logo">
<h1><img src="<?php echo get_template_directory_uri(""); ?>/images/logo.png"></h1>
</div>
<div class="social">
<ul>
<li><img src="<?php echo get_template_directory_uri(""); ?>/images/social-instagram.png"></li>
<li><img src="<?php echo get_template_directory_uri(""); ?>/images/social-facebook.png"></li>
<li><img src="<?php echo get_template_directory_uri(""); ?>/images/social-twitter.png"></li>
<li><img src="<?php echo get_template_directory_uri(""); ?>/images/social-youtube.png"></li>
<li><img src="<?php echo get_template_directory_uri(""); ?>/images/social-feed.png"></li>
</ul>
</div>
</div>
</header>
<?php global $post;
if ( is_home() ) { ?>
<section class="content container">
<?php query_posts('category_name=destaque&posts_per_page=1'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="imagem-destaque">
<a href="<?php the_permalink() ?>"><?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'home1' );
}
?></a>
<div class="meta-destaque">
<span class="categoria-destaque"><ul>
<li>
<?php
$category = get_the_category();
if($category[0]){
echo ''.$category[0]->cat_name.'';
}
?>
</li>
</ul></span>
<h3><?php the_title(); ?></h3>
</div>
</div>
<?php endwhile;?>
<?php rewind_posts(); ?>
<?php wp_reset_query(); ?>
<?php query_posts('category_name=mini-destaque&posts_per_page=2'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="micro-destaque">
<a href="<?php the_permalink() ?>"><?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'home2' );
}
?></a>
<div class="micro-meta-destaque">
<span class="micro-categoria-destaque"><ul>
<li>
<?php
$category = get_the_category();
if($category[0]){
echo ''.$category[0]->cat_name.'';
}
?>
</li>
</ul></span>
<h3><?php the_title(); ?></h3>
</div>
</div>
<?php endwhile;?>
<?php rewind_posts(); ?>
<?php wp_reset_query(); ?>
</section>
<div class="clearfix"></div>
<?php } else { ?>
<?php } ?>
<nav class="container menu-topo">
<?php wp_nav_menu( array('menu' => 'topo' )); ?>
</nav>
And this is the archive.php
<?php get_header(); ?>
<section class="website-content container">
<section class="posts">
<?php rewind_posts(); ?>
<?php
if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
else { $paged = 1; }
query_posts('posts_per_page=10&paged=' . $paged);
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="meta">
<div class="date">
<?php the_time('j \d\e F') ?>
</div>
<div class="categoria">
<ul>
<li>
<?php
$category = get_the_category();
if($category[0]){
echo ''.$category[0]->cat_name.'';
}
?>
</li>
</ul>
</div>
<div class="author">
postado por <?php the_author_posts_link() ?>
</div>
</div>
<h2><?php the_title(); ?></h2>
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<div class="text-article">
<?php the_excerpt(); ?>
</div>
</article>
<?php endwhile; else: ?>
<article>
<p>Nenhum post encontrado.</p>
</article>
<?php endif; ?>
<?php wp_pagenavi(); ?>
</section>
<aside class="sidebar">
<?php get_sidebar(); ?>
</aside>
</section>
<?php get_footer(); ?>
Any Idea? :(
It was a bug at index.php. Loop problems. Fixed it.

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

Categories