What am I doing wrong?
]]>On index.php i added the next code at the begining of the loop:
<?php query_posts(‘cat=3&posts_per_page=30’);?>
It duplicates the latest post and displays all posts, no matter i assigned the id of one category.
]]>First one is a 404 file not found for my foundation.min.js file. When I inspect my website there are a bunch of 20%20% added to my theme location on my server (https://www.peconicwatersports.com/wp-content/themes/JointsWP-CSS-master%20%20%20%20/foundation/js/foundation.min.js) that should not be there.
I am a bit confused on how to locate where the foundation.min.js is referenced in my theme. Would this cause my modal boxes/drop down menu items to not appear?
I am using JointsWP theme. Any help would be greatly appreciated. Thank you!
]]>I’ve added some body_class functions to my function.php file but the is_post_type_archive class is not being added. All the rest are working. Also, all template classes are missing.
I made a custom post type called yacht_for_sale but even if I enter that in the brackets it doesn’t work. I’m using a custom archive page, ie archive-yacht_for_sale, which is working but the only classes that appear in the body are:
<body class="blog logged-in hyg-blog-index 2008-jeanneau-54ds-good-fortune">
So it’s using the archive custom template but seeing it as the ‘home’ page for the blog.
As you can see it’s adding the class hyg-blog-index, but it should be giving it hyg-yacht-index. It’s also not including the template class, which according to the codex it should be doing. It’s also adding the first post title as a class, although the archive template has 9 posts in random order, so it’s a useless class for purposes of styling.
This is the code in my function.php file:
add_filter( 'body_class','my_body_classes' );
function my_body_classes( $classes ) {
if (is_page(array(13,41,44))) {
$classes[] = 'parent-pageid-23';
} elseif (is_post_type_archive()){
$classes[] = 'hyg-yacht-index';
} elseif (is_home()) {
$classes[] = 'hyg-blog-index';
} elseif (is_singular('post')) {
$classes[] = 'hyg-blog-single';
}
return $classes;
}
function add_body_class( $hygclasses )
{
global $post;
if ( isset( $post ) ) {
$hygclasses[] = $post->post_name;
}
return $hygclasses;
}
add_filter( 'body_class', 'add_body_class' );
The site is not viewable without a login as yet while it’s in development. I’d be happy to provide one for anyone who can help.
I’m using JointsWP.
I’ve tried everything I can think of to get this working.
Even just getting to add the template being used as body class would help me.
This site is supposed to be going live next week, but I can’t style the blog without getting some kind of different class within the body.
Help or alternative solutions are welcome and gratefully received.
Cheers,
Tracy
So I have been using Foundation 5 and JointsWP start theme to build websites. I start off with just using Foundation and build out the structure in HTML/CSS then I port it over to JointsWP. Most of the sites I have done have worked with no issues but this one seems to be causing some issues.
I think my problem lies in where i’m calling all the JS files in my footer/header/ and the enqueue-scripts.php file that JointsWP comes with. I have tested a number of combinations things but can’t see to remove the errors the console is throwing up and also can’t get my sticky header to stop glitching out in chrome without breaking the mobile nav. I know this has something to do with all the different things i’m calling in the footer and enqueue-scripts.php file because I can get either one or the other working but not both, also my modal is broken to and I think that has something to do with it.
Im hoping someone can give me some organization tips, take a look at what i’m calling and maybe let me know what should go where and when combining the two (foundation 5 and JointsWP) what can be removed?
And maybe take a look at what I have now and tell me what’s wrong?
Footer
<script src="<?php bloginfo('template_directory'); ?>/assets/js/vendor/jquery.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.3/js/foundation.min.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_directory'); ?>/assets/royalslider/jquery.royalslider.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).foundation();
$(".royalSlider").royalSlider({
// options go here
imageScaleMode: 'fill',
autoHeight: true,
transitionType: 'fade',
controlNavigation: 'none',
navigateByClick: true,
imageScalePadding: 0,
imageAlignCenter: false,
keyboardNavEnabled: true,
keyboardNavEnabled: true,
navigateByClick: true,
sliderDrag: true,
});
</script>
<?php wp_footer(); ?>
Header
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/assets/royalslider/royalslider.css" type="text/css">
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/assets/royalslider/skins/default/rs-default.css" type="text/css">
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/assets/css/custom.css" type="text/css"><!-- JS -->
<!-- JS -->
<script src="<?php bloginfo('template_directory'); ?>/assets/vendor/modernizr/modernizr.js" type="text/javascript"></script>
enqueue-scripts.php
<?php
function joints_scripts_and_styles() {
global $wp_styles; // Call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
if (!is_admin()) {
$theme_version = wp_get_theme()->Version;
// Removes WP version of jQuery
wp_deregister_script('jquery');
// Loads jQuery from vendor Files
wp_enqueue_script( 'jquery', get_template_directory_uri() . '/assets/vendor/foundation/js/vendor/jquery.js', array(), '2.1.3', true );
// Adding scripts file in the footer
wp_enqueue_script( 'site-js', get_template_directory_uri() . '/assets/js/scripts.js', array( 'jquery' ), '', true );
// Normalize from vendor files
wp_enqueue_style( 'normalize-css', get_template_directory_uri() . '/assets/vendor/foundation/css/normalize.min.css', array(), '', 'all' );
// Adding Foundation styles
wp_enqueue_style( 'foundation-css', get_template_directory_uri() . '/assets/vendor/foundation/css/foundation.min.css', array(), '', 'all' );
// Register main stylesheet
wp_enqueue_style( 'site-css', get_template_directory_uri() . '/assets/css/style.css', array(), '', 'all' );
// Comment reply script for threaded comments
if ( is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) {
wp_enqueue_script( 'comment-reply' );
}
}
}
add_action('wp_enqueue_scripts', 'joints_scripts_and_styles', 999);
?>
Thanks for any help guys!
[Moderator Note: No bumping, thank you.]
]]><?php
/*
Template Name: Portfolio Page
*/
?>
<?php get_header(); ?>
<div class="row section-row-container">
<div class="large-12 medium-12 small-12 columns section-title-container">
<h2 class="page-title"><?php the_title(); ?></h2>
</div>
</div>
<div id="gridcontainer">
<?php
$type = 'portfolio';
$args = array(
'post_type' => $type,
'post_status' => 'publish',
'posts_per_page' => 6);
$my_query = null;
$my_query = new WP_Query($args);
$counter = 1; //start counter
$grids = 2; //Grids per row
if( $my_query->have_posts() ) { ?>
<div class="row section-row-container">
<?php while ($my_query->have_posts()) : $my_query->the_post();
if($counter == 1) : ?>
<div class="griditemleft">
<div class="postimage">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('category-thumbnail'); ?></a>
</div>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p class="post-date-portfolio">Posted On <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '| <a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
}
?></p>
</div>
<?php elseif($counter == $grids) : ?>
<div class="griditemright">
<div class="postimage">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('category-thumbnail'); ?></a>
</div>
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<p class="post-date-portfolio">Posted On <time datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '| <a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
}
?></p>
</div>
<div class="cleargrid"></div>
<?php
$counter = 0;
endif;
?>
<?php
$counter++;
endwhile;?>
</div>
<?php
}
wp_reset_postdata();
?>
</div>
<?php joints_page_navi(); ?>
<?php get_footer(); ?>
Here is the code for the joints_page_navi();
<?php
// Numeric Page Navi (built into the theme by default)
function joints_page_navi($before = '', $after = '') {
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ( $numposts <= $posts_per_page ) { return; }
if(empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = 7;
$pages_to_show_minus_1 = $pages_to_show-1;
$half_page_start = floor($pages_to_show_minus_1/2);
$half_page_end = ceil($pages_to_show_minus_1/2);
$start_page = $paged - $half_page_start;
if($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if(($end_page - $start_page) != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if($start_page <= 0) {
$start_page = 1;
}
echo $before.'<div class="row section-row-container"><nav class="page-navigation"><ul class="pagination">'."";
if ($start_page >= 2 && $pages_to_show < $max_page) {
$first_page_text = __( "First", 'jointstheme' );
echo '<li><a href="'.get_pagenum_link().'" title="'.$first_page_text.'">'.$first_page_text.'</a></li>';
}
echo '<li>';
previous_posts_link('<<');
echo '</li>';
for($i = $start_page; $i <= $end_page; $i++) {
if($i == $paged) {
echo '<li class="current"><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
} else {
echo '<li><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
}
}
echo '<li>';
next_posts_link('>>');
echo '</li>';
if ($end_page < $max_page) {
$last_page_text = __( "Last", 'jointstheme' );
echo '<li><a href="'.get_pagenum_link($max_page).'" title="'.$last_page_text.'">'.$last_page_text.'</a></li>';
}
echo '</ul></nav></div>'.$after."";
} /* End page navi */
?>
Thanks!
]]>I have set up JointsWP theme. But the comment section is not working. It’s not showing up at the at of the post and page.
]]>I’m displaying 5 posts per page (set in the settings->reading section of the backend) and the pagination links are showing up at the bottom of the page but when I click on them instead of loading new posts on the new page it loads the same posts from the first page. I’m developing this site on my localhost so here’s the code I’m using:
This problem is in the index.php:
<?php if (have_posts()) :query_posts('category_name=announcements'); while (have_posts()) : the_post(); ?>
<?php get_template_part( 'partials/loop', 'archive' ); ?>
<?php endwhile; ?>
<?php if (function_exists('joints_page_navi')) { ?>
<?php joints_page_navi(); ?>
<?php } else { ?>
<nav class="wp-prev-next">
<ul class="clearfix">
<li class="prev-link"><?php next_posts_link(__('« Older Entries', "jointstheme")) ?></li>
<li class="next-link"><?php previous_posts_link(__('Newer Entries »', "jointstheme")) ?></li>
</ul>
</nav>
<?php } ?>
<?php else : ?>
<?php get_template_part( 'partials/content', 'missing' ); ?>
<?php endif; ?>
& here’s the joints_page_navi function:
function joints_page_navi($before = '', $after = '') {
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ( $numposts <= $posts_per_page ) { return; }
if(empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = 7;
$pages_to_show_minus_1 = $pages_to_show-1;
$half_page_start = floor($pages_to_show_minus_1/2);
$half_page_end = ceil($pages_to_show_minus_1/2);
$start_page = $paged - $half_page_start;
if($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if(($end_page - $start_page) != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if($start_page <= 0) {
$start_page = 1;
}
echo $before.'<nav class="page-navigation"><ul class="pagination">'."";
if ($start_page >= 2 && $pages_to_show < $max_page) {
$first_page_text = __( "First", 'jointstheme' );
echo '<li class="bpn-first-page-link"><a href="'.get_pagenum_link().'" title="'.$first_page_text.'">'.$first_page_text.'</a></li>';
}
echo '<li class="bpn-prev-link">';
previous_posts_link('<<');
echo '</li>';
for($i = $start_page; $i <= $end_page; $i++) {
if($i == $paged) {
echo '<li class="current"><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
} else {
echo '<li><a href="'.get_pagenum_link($i).'">'.$i.'</a></li>';
}
}
echo '<li class="bpn-next-link">';
next_posts_link('>>');
echo '</li>';
if ($end_page < $max_page) {
$last_page_text = __( "Last", 'jointstheme' );
echo '<li class="bpn-last-page-link"><a href="'.get_pagenum_link($max_page).'" title="'.$last_page_text.'">'.$last_page_text.'</a></li>';
}
echo '</ul></nav>'.$after."";
}
I’m really lost here & don’t know how to fix this. let me know if you need to see more code. I’m willing to try something else like infinite post or a pagination plugin if that makes more sense…anything but a busted pagination! thank you for your help!!!
]]>