Home: http://blog.priworks.com/ Posts: http://bit.ly/19kLqEI Category: http://bit.ly/16rFJUK
I had a pharma hack and installed a clean version of wordpress and copied over only what I needed after cleaning it. I did'nt modify the theme but for some reason the get statement isn't working on the categories and posts pages.
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Has anyone experienced this, is it safe to try include instead?
Posts/Category template single.php
<?php
/**
* #package WordPress
* #subpackage Default_Theme
*/
get_header();
?>
<div id="content" class="widecolumn" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!--<div class="navigation">
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
<div class="alignright"><?php next_post_link('%link »') ?></div>
</div>-->
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h6 class="singletitleh6"><?php the_title(); ?></h6>
<span style="text-transform: uppercase; font-size: 0.8em; letter-spacing: 1px; margin-bottom: 20px; display: block; color: #666;">by <?php the_author_posts_link(); ?></span>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
<p class="postmetadata">
<span style="font-size: 0.9em; margin-bottom: 10px; display: block; color: #666;">Posted by <?php the_author_posts_link();?><?php //the_author(); ?> | <a style="color: #666;" href="<?php the_permalink(); ?>">Permalink</a> | <span class="num_comments_style"><?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?></span> | <span style="font-weight: bold;">Trackbacks (<?php trackback_count(); ?>)</span> | <?php sharethis_button(); ?></span>
</p>
<p class="postmetadata"><span style="font-size: 0.9em; margin-bottom: 20px; display: block; color: #666;"><?php the_tags( 'Tags: ', ', ', ''); ?></span></p>
<p class="postmetadata alt">
<small>
This entry was posted
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
and is filed under <?php the_category(', ') ?>.
You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
<?php if ( comments_open() && pings_open() ) {
// Both Comments and Pings are open ?>
You can leave a response, or trackback from your own site.
<?php } elseif ( !comments_open() && pings_open() ) {
// Only Pings are Open ?>
Responses are currently closed, but you can trackback from your own site.
<?php } elseif ( comments_open() && !pings_open() ) {
// Comments are open, Pings are not ?>
You can skip to the end and leave a response. Pinging is currently not allowed.
<?php } elseif ( !comments_open() && !pings_open() ) {
// Neither Comments, nor Pings are open ?>
Both comments and pings are currently closed.
<?php } edit_post_link('Edit this entry','','.'); ?>
</small>
</p>
</div>
</div>
<div style="margin: 50px 70px 10px 42px; text-align: left;">
<?php comments_template(); ?>
</div>
<?php endwhile; else: ?>
<div style="margin: 50px 70px 10px 42px; text-align: left;">
<p>Sorry, no posts matched your criteria.</p>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Related
Seems like a silly question, but I can't display posts in three columns.
I was using this code with bootstrap, but I can't anymore because it somehow breaks other parts of my page. I had to change it.
<div class="row" style="margin-top:-30px">
<?php
$count=0;
query_posts('posts_per_page=9');
while (have_posts()) : the_post();
?>
<div class="col-sm-4 blog-post thumb">
<?php get_template_part('content-noticias', get_post_format()); ?>
</div>
<?php
$count++;
if($count == 3 || $count == 6 ) echo '</div><div class="row">';
endwhile;
?>
</div>
It would do the work, but not anymore because of that. How to display my posts in columns without bootstrap? Just for information, my content-noticias is:
<div class="noticias">
<?the_post_thumbnail();?>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div><p><?php echo wp_trim_words( get_the_content(), 50 ); ?></p></div>
</div>
</div>
Hey man for row you can use css property flex-flow: row wrap; and for child items flex-basis: 33%; and any of your items in your post loop will be in 3 columns , and you can change flex basis for other mediaquery for change sie on mobile for example, check this out !
.container {
max-width: 1335px;
margin: 0 auto;
}
.grid-row {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
}
.grid-item {
height: 250px;
flex-basis: 33%;
-ms-flex: auto;
width: 250px;
position: relative;
padding: 10px;
box-sizing: border-box;
background-color: #ededed;
border: 1px solid white;
}
#media(max-width: 1333px) {
.grid-item {
flex-basis: 33.33%;
}
}
#media(max-width: 1073px) {
.grid-item {
flex-basis: 33.33%;
}
}
#media(max-width: 815px) {
.grid-item {
flex-basis: 33%;
}
}
#media(max-width: 555px) {
.grid-item {
flex-basis: 100%;
}
}
<div class='container'>
<div class='grid-row'>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
</div>
</div>
The problem is in your $count if statement:
if($count == 3 || $count == 6 ) echo '</div><div class="row">'; <-- THIS WILL NEVER CLOSE
What you can do is this:
<div class="row" style="margin-top:-30px">
<?php
query_posts('posts_per_page=9');
while (have_posts()) : the_post();
?>
<div class="col-sm-4 blog-post thumb">
<?php get_template_part('content-noticias', get_post_format()); ?>
</div>
<?php endwhile;?>
</div>
Then you can use CSS to make sure your columns stay intact:
.row .blog-post:nth-child(3n+1) {
clear: left;
}
That will make sure that every third element will clear so if one of the columns is longer or shorter, it won't mess with the layout.
Below is the code that was put together by my developer but we're still having problems printing uniformly from http://sandboxalleninvestments.com/person/keith-albritton/. It prints fine when printing as a PDF but outside of that, it's all wonky. I'm out of time and running out of hair to pull out. On some printers it works on some days, on other it does not.
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
// $post_id = get_the_id();
?>
<style>
#media print {
.container {
width: 100%;
}
.bio__content {
max-width: none;
}
.bio__content p {
font-size:16px !important; }
}
.subheader--bio .tabelize__content h1 {
font-size: 35px !important;
}
.bio__content hr {
margin:0;
}
.bio__content p {
padding:0 30px;
}
} /* #media print */
</style>
<div class="subheader subheader--bio">
<img src="<?php the_field("bio_picture"); ?>" alt="">
<div class="container">
<div class="tableize tableize--middle">
<div class="tableize__cell">
<div class="tabelize__content">
<?php
$first_name = get_field('first_name');
$last_name = get_field('last_name'); ?>
<h1><?php echo $first_name . " " . $last_name ?></h1>
<small><?php the_field('job_title'); ?></small>
</div>
</div>
</div>
</div>
</div>
<main class="main main--inner main--border">
<div class="container">
<div class="bio__content">
<div class="bio__bar">
<ul class="socials list--nostyle">
<?php if (get_field('facebook')) : ?>
<li>
<svg role="img" class="icon icon--fb"><use xlink:href="<?php echo get_template_directory_uri() . '/icons/icons.svg#icon-fb' ?>"></use></svg>
</li>
<?php endif; ?>
<?php if (get_field('instagram')) : ?>
<li>
<svg role="img" class="icon icon--in"><use xlink:href="<?php echo get_template_directory_uri() . '/icons/icons.svg#icon-in' ?>"></use> </svg>
</li>
<?php endif; ?>
</ul>
<?php if(get_field('team')) : ?>
View Team Page
<?php endif; ?>
</div>
<?php the_field('description'); ?>
<hr>
<div class="bio__footer">
Print Bio
</div>
</div>
</div>
</main>
<?php endwhile; endif; ?>
<?php
get_footer();
?>
Here's a screenshot of the problem. You can see that the margins are way off and the font doesn't match the code (size-wise):
http://i.stack.imgur.com/93qDn.jpg
I tried to use wordpress function query_posts('showposts=3&cat=1') to display the latest posts under category 1. But it displays 4 or 5 posts. Could you please help figure out the root cause? Thanks.
<?php query_posts('showposts=3&cat=17');?>
<div class="n-placement n-widget w-image-text" data-type="image-text" id="u-aabm">
<div class="n-inner" id="u-aabm-i">
<div class="w-image-text-container">
<span class="w-image-text-image" style="float: left; clear: left; margin-top: 6px; margin-bottom: 6px; margin-right: 6px;">
<img src="<?php echo catch_that_image();?>" height="112" width="112"/>
</span>
<div class="w-image-text-text">
<b>
<!--<?php the_title(); ?>-->
<?php the_title(); ?>
</b>
<div>
<div>
<?php
if(is_category() || is_archive() || is_home() ) {
the_excerpt();
} else {
the_content('Read the rest of this entry »');
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
You need to start the loop after you define the query_posts().
So the code becomes:
<?php query_posts('showposts=3&cat=17');
while (have_posts()) : the_post(); ?>
<div class="n-placement n-widget w-image-text" data-type="image-text" id="u-aabm">
<div class="n-inner" id="u-aabm-i">
<div class="w-image-text-container">
<span class="w-image-text-image" style="float: left; clear: left; margin-top: 6px; margin-bottom: 6px; margin-right: 6px;">
<img src="<?php echo catch_that_image();?>" height="112" width="112"/>
</span>
<div class="w-image-text-text">
<b>
<!--<?php the_title(); ?>-->
<?php the_title(); ?>
</b>
<div>
<div>
<?php
if(is_category() || is_archive() || is_home() ) {
the_excerpt();
} else {
the_content('Read the rest of this entry »');
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
All of a sudden the "full left secondary-bg" background div on this page: http://goo.gl/OU4MkW is not going to the full width of the screen, and I cannot understand why. It's a WordPress based site built on skeleton framework. Here's the php for the body area of the page:
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if (!is_page_template('onecolumn-page.php')) { ?>
<?php if (is_front_page() && !get_post_meta($post->ID, 'hidetitle', true)) { ?>
<div class="full left secondary-bg">
<div class="container">
<div class="sixteen columns alpha">
<div class="eight columns alpha hp">
<?php the_content()?>
</div>
<div class="seven columns offset-by-one omega">
<div class="post-area">
<h2><?php the_field('featured_art_title'); ?></h2>
<div class="featured-post-wrap">
<img src="<?php the_field('featured_art_image'); ?>" alt="Featured Art Post" />
</div>
<p>
<?php the_field('featured_art_description'); ?> View More
</p>
</div>
</div>
</div>
</div><!-- container -->
</div>
<?php } elseif (!get_post_meta($post->ID, 'hidetitle', true)) { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } else {
echo '<br />';
} ?>
<?php } ?>
<!--<div class="full left">
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'skeleton' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'skeleton' ), '<span class="edit-link">', '</span>' ); ?>
</div> .entry-content -->
<?php comments_template( '', false ); ?>
Any help would be greatly appreciated!
change skeleton.css, please change the following line in css add width line
.column, .columns
{ float: left; display: inline;
/*margin-left: 10px; margin-right: 10px;*/
/* add width to 100% */
width: 100%;
}
I modifying a wordpress template to be left with two columns on the main page with the following structure:
But the first 4 are of a category and the last 4 of another
The index code is:
http://pastebin.com/dMC0saBN
The page is (Columns are made, but all they do is repeat the post. They haven't order or filter)
crossfitlascondes.cl
The solution I occurred was to create two loops on the page and separated by , one to right column and one to left column. And so I can handle the code for each loop independently without interfering with the other column.
The code of index is:
<?php get_header();?>
<div id="contentslide">
<?php
include(TEMPLATEPATH . '/slide.php');
?>
</div>
<?php
get_sidebar();
?>
<div id="content">
<div class="clear">
</div>
<div id="contentleft">
<div id="noticias">Noticias</div>
<?php if ( is_home() ) { query_posts($query_string . '&cat=-27'); } ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="postleft" id="post-<?php
the_ID();
?>">
<div class="title">
<h2><a href="<?php
the_permalink();
?>" rel="bookmark" title="Permanent Link to <?php
the_title();
?>"><?php
the_title();
?></a></h2>
</div>
<div class="postmeta">
<span class="author">Posted by <?php
the_author();
?> </span> <span class="clock"> <?php
the_time('M - j - Y');
?></span> <span class="comm"><?php
comments_popup_link('0 Comment', '1 Comment', '% Comments');
?></span>
</div>
<div class="entry">
<?php
if (has_post_thumbnail()) {
?>
<a href="<?php
the_permalink();
?>"><img class="postimgleft" src="<?php
bloginfo('stylesheet_directory');
?>/timthumb.php?src=<?php
get_image_url();
?>&h=150&w=200&zc=1" alt=""/></a>
<?php
} else {
}
?>
<?php
wpe_excerpt('wpe_excerptlength_index', '');
?>
<div class="clear">
</div>
</div>
</div>
<?php
endwhile;
?>
<?php
endif;
?>
<?php
wp_reset_query();
?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php next_posts_link('Next Entries »','') ?></div>
</div>
</div>
<div id="contentright">
<div id="wod">WOD Diario</div>
<?php if ( is_home() ) { query_posts($query_string . '&cat=27&'); } ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="postright" id="post-<?php
the_ID();
?>">
<div class="title">
<h2><a href="<?php
the_permalink();
?>" rel="bookmark" title="Permanent Link to <?php
the_title();
?>"><?php
the_title();
?></a></h2>
</div>
<div class="postmeta">
<span class="author">Posted by <?php
the_author();
?> </span> <span class="clock"> <?php
the_time('M - j - Y');
?></span> <span class="comm"><?php
comments_popup_link('0 Comment', '1 Comment', '% Comments');
?></span>
</div>
<div class="entry">
<?php
if (has_post_thumbnail()) {
?>
<a href="<?php
the_permalink();
?>"><img class="postimgright" src="<?php
bloginfo('stylesheet_directory');
?>/timthumb.php?src=<?php
get_image_url();
?>&h=150&w=200&zc=1" alt=""/></a>
<?php
} else {
}
?>
<?php
wpe_excerpt('wpe_excerptlength_index', '');
?>
<div class="clear">
</div>
</div>
</div>
<?php
endwhile;
?>
<div class="clear"></div>
<?php
else:
?>
<h1 class="title">Not Found</h1>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php
endif;
?>
<div class="navigation">
<div class="alignleft"><?php previous_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php next_posts_link('Next Entries »','') ?></div>
</div>
<?php
wp_reset_query();
?>
</div>
</div>
<?php
get_footer();
?>
and the code CSS(summarized) is
#content {
float:left;
width: 665px;
height:100%;
padding:10px 0px 0px 0px;
margin:23px 0px 0px 15px;
display:inline;
overflow:hidden;
}
#contentleft {
float:left;
width: 50%;
height:100%;
display:inline;
overflow:hidden;
}
#contentright {
float:left;
width: 44%;
margin-left: 23px;
height:100%;
display:inline;
overflow:hidden;
}
#contentslide {
float:left;
width: 665px;
height:100%;
padding:10px 0px 0px 0px;
margin:35px 0px 0px 15px;
display:inline;
overflow:hidden;
}