Forum Replies Created
-
AuthorPosts
-
brettatkinMember
I'm not sure how this answers my question.
brettatkinMemberHere is the solution that worked for me. It is what I expected I needed to do - I let the initial solution I found control my thinking rather than looking for another solution. Thanks to Carrie Dills (as usual) for getting me back on track. Here is the post form Carrie: https://carriedils.com/custom-page-template-genesis/
Here is my final code:
<?php //* Remove the ad widget remove_action( 'genesis_before_loop', 'adspace_before_loop' ); //* Remove author box remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 ); //* Remove the post meta function remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); //* Remove the post info function remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); //* Remove the post image (requires HTML5 theme support) remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); //* Remove the entry title (requires HTML5 theme support) remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); //* Remove the post content remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'dr_work_loop' ); function dr_work_loop() { $args_1 = (array( 'post_type' => 'work', 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'work-type', 'field' => 'slug', 'terms' => 'dwell', ), ), 'posts_per_page' => -1 )); $loop = new WP_Query( $args_1 ); if( $loop->have_posts() ) { // loop through posts echo '<h2 id="dwell">Dwell</h2>'; while( $loop->have_posts() ): $loop->the_post(); echo '<div class="archive-featured-image type-work">'; echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; echo get_the_post_thumbnail($thumbnail->ID); echo '</a>'; echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; echo the_title( '<p class="work-title">', '</p>' ); echo '</a>'; echo '</div>'; endwhile; echo '<div style="clear: both;"></div>'; } wp_reset_postdata(); $args_2 = (array( 'post_type' => 'work', 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'work-type', 'field' => 'slug', 'terms' => 'commerce', ), ), 'posts_per_page' => -1 )); $loop = new WP_Query( $args_2 ); if( $loop->have_posts() ) { // loop through posts echo '<h2 id="commerce">Commerce</h2>'; while( $loop->have_posts() ): $loop->the_post(); echo '<div class="archive-featured-image type-work">'; echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; echo get_the_post_thumbnail($thumbnail->ID); echo '</a>'; echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; echo the_title( '<p class="work-title">', '</p>' ); echo '</a>'; echo '</div>'; endwhile; echo '<div style="clear: both;"></div>'; } wp_reset_postdata(); $args_3 = (array( 'post_type' => 'work', 'order' => 'DESC', 'orderby' => 'date', 'post_status' => 'publish', 'tax_query' => array( array( 'taxonomy' => 'work-type', 'field' => 'slug', 'terms' => 'Interiors', ), ), 'posts_per_page' => -1 )); $loop = new WP_Query( $args_3 ); if( $loop->have_posts() ) { // loop through posts echo '<h2 id="interiors">Interiors</h2>'; while( $loop->have_posts() ): $loop->the_post(); echo '<div class="archive-featured-image type-work">'; echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; echo get_the_post_thumbnail($thumbnail->ID); echo '</a>'; echo '<a href="' . get_permalink() .'" title="' . the_title_attribute( 'echo=0' ) . '">'; echo the_title( '<p class="work-title">', '</p>' ); echo '</a>'; echo '</div>'; endwhile; } wp_reset_postdata(); } genesis();
brettatkinMemberarchive-work.php
brettatkinMemberNot sure what you mean by seamlessly. Here is an example on a site I'm still working on.
See the next/previous at the bottom of the page. You can paginate through all five employees. Each employee is a post (a CPT).
I'm doing the same thing in another section that paginates through posts, but limited to the taxonomy term for that post.
If each book page is a post with a taxonomy of "book 1", they should be able to page through the posts. The only time consuming piece would be getting the pages in order.
brettatkinMemberNot sure if this will help (it is alternative to what you asked), but I just did something similar where I added pagination for a CPT based on the custom taxonomy. Here is my code:
add_action( 'genesis_entry_footer', 'dr_work_prev_next_post_nav_cpt' ); function dr_work_prev_next_post_nav_cpt() { if ( ! is_singular( array( 'work', 'post' ) ) ) //add your CPT name to the array return; genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'adjacent-entry-pagination', ) ); echo '<div class="pagination-previous alignleft">'; previous_post_link( '%link', 'Previous Project', TRUE, '', 'work-type' ); echo '</div>'; echo '<div class="pagination-next alignright">'; next_post_link( '%link', 'Next Project', TRUE, '', 'work-type' ); echo '</div>'; echo '</div>'; }
In this line (previous_post_link( '%link', 'Previous Project', TRUE, '', 'work-type' );), work-type is the name of my custom taxonomy. What happens is that the pagination works just for items that have the same taxonomy value.
So, you could try creating a custom taxonomy for the CPT, create values for each book. Then for each page, assign it that book value and order the posts accordingly.
brettatkinMemberHere is the code for the CPT and CPT Taxonomy. I'm mixing categories (in the WP sense) with my general categorization scheme for the projects. I see why you're confused. Here is a screenshot of my taxonomy setup.
http://dr.betaforming.com/work-types.gif
Here is the code for my CPT and CPT Taxonomy.
//* Create Work custom taxonomy add_action( 'init', 'executive_type_taxonomy' ); function executive_type_taxonomy() { register_taxonomy( 'work-type', 'work', array( 'labels' => array( 'name' => _x( 'Types', 'taxonomy general name', 'executive' ), 'add_new_item' => __( 'Add New Work Type', 'executive' ), 'new_item_name' => __( 'New Work Type', 'executive' ), ), 'exclude_from_search' => true, 'has_archive' => true, 'hierarchical' => true, 'rewrite' => array( 'slug' => 'work-type', 'with_front' => false ), 'show_admin_column' => true, 'show_ui' => true, 'show_tagcloud' => false, ) ); } //* Create Work custom post type add_action( 'init', 'work_post_type' ); function work_post_type() { register_post_type( 'work', array( 'labels' => array( 'name' => __( 'Work', 'executive' ), 'singular_name' => __( 'Work', 'executive' ), ), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => 'dashicons-images-alt2', 'public' => true, 'rewrite' => array( 'slug' => 'work', 'with_front' => false ), 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'page-attributes', 'genesis-seo', 'genesis-cpt-archives-settings' ), 'taxonomies' => array( 'work-type' ), ) ); }
brettatkinMemberYes, I want to display all the projects broken down by category (Dwell, Commerce and Interiors) - the one taxonomy (work-type) has three categories.
Not sure what you mean by the $thumbnail variable. Why do I need to define that?
Yes, ultimately the url will be /work. I had the slug configured for my CPT to be work/projects just so I could keep the other working example. I have removed that page and updated my CPT slug to be what it should be in the end. So the new URL is:
http://dr.betaforming.com/work/
Thanks
brettatkinMemberPretty sure that response isn't going to get you more help from Brad and many others...
Either way, stating that is has to work with Genesis is misleading because in the end, it is just HTML, CSS and JS. The Tri.be is a WP site - have you looked at the code?. If you want something off the shelf that "works" with Genesis, than Brad's recommendation is likely the most viable and you'll have to adjust your expectations.. If that isn't what you want, have you looked at the inspiration for this plugin?
http://tympanus.net/Development/FullscreenOverlayStyles/index.html
I'm pretty confident you're not going to find some point and click solution for this that perfectly fits your needs.
brettatkinMemberI second Brad's recommendation. If you want to spend a few dollars and work through a bigger learning curve, you can do some pretty amazing things with the Revolution Slider.
brettatkinMemberVictor, I want to do what the default WooCommerce Shop page does. It the Dashboard, WC creates a page called "shop". What I enter on that page for the Title and Content shows up on the Shop page above the product output.
I hard-coded the Title and Content into the page_blog.php template file, but I want to make this dynamic - the client can update.
Does that help?
Thanks
Brett
brettatkinMemberThank you for the help Victor. I did have to change the name of the template file.
I thought child theme pages were supposed to get loaded "last" - supersede the parent theme pages?
I'll check out your article on the new Sitemap Filter.
Thanks again.
Brett
January 12, 2016 at 10:09 am in reply to: Missing Pagination on Custom Blog Home Page Template #176301brettatkinMember!@#@#$!@$!@#, as soon as read this I remembered that this was set in the Theme Settings and not Settings > Reading for any pages using the Blog template. My custom category archive pages use the Settings > Reading setting.
Why does Genesis overwrite this?
Thanks!
Brett
brettatkinMemberThanks for the Query Monitor recommendation. That is very cool. I ended up creating a page_blog.php file in the child theme after finding it in the framework theme (I should have looked there first and your reminder prompted me to look further....) and customizing it.
Why does Genesis use a page template for the post archive page functionality unlike all the other themes I've worked with?
Everything else is working as I want except for one thing that I'll ask in a separate question because it isn't related to this issue.
Thanks again!
Brett
brettatkinMemberYep, that took care of things. I also added the code from the Enterprise Pro theme to make it work better.
Thanks!
Brett
brettatkinMemberThank you Christopher, that took care of things.
Brett
brettatkinMemberThis isn't an issue with the footer widgets. The theme is set up for 3 footer columns I believe. When you restore the original CSS code, do the columns line up and resize correctly?
brettatkinMemberWorked perfectly, thanks!
Brett
brettatkinMemberThere is a fixed width for the footer widget divs (270px). It should be a percentage. Is this the default for theme or did you change it?
brettatkinMemberThanks for the help Jackie. The first two links you provided didn't work. It highlighted the menu item regardless of the page/post because "menu-item-#" gets added no matter where you are on the site.
You're code worked for me though, thanks!
You were correct, I had added some extra code to my site to achieve the same thing for the blog posts. I forgot about doing that.
I looked back at a couple of my custom coded WP themes and this isn't an issue - individual blogs pages are applying the appropriate active classes to the nav menu item. It appears Genesis is using Superfish for the navigation. Could this be the problem? It really seams this should work out of the box, it does for parent child pages.
This is what worked on the Porsche Site. For some reason, this code isn't working for The Events Calendar CPT from Modern Tribe.
add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2); function special_nav_class($classes, $item){ if(is_single() && ('gallery' == get_post_type()) && $item->title == 'Photo Galleries' ){ $classes[] = 'current-menu-item'; } if(is_single() && ('classifieds' == get_post_type()) && $item->title == 'Classifieds' ){ $classes[] = 'current-menu-item'; } if(is_single() && ('tribe_events' == get_post_type()) && $item->title == 'Upcoming Events' ){ $classes[] = 'current-menu-item'; } if(is_single() && ('post' == get_post_type()) && $item->title == 'Recent News' ){ $classes[] = 'current-menu-item'; } return $classes; }
This is what worked in the IOI site. This WOULD NOT work on the Porsche site because I have multiple post types.
function add_custom_class($classes=array(), $menu_item=false) { if ( !is_home() && !is_page() && 'Blog' == $menu_item->title && !in_array( 'current-menu-item', $classes ) ) { $classes[] = 'current-menu-item'; } return $classes; } add_filter('nav_menu_css_class', 'add_custom_class', 100, 2);
brettatkinMemberJackie,
Thank you for the additional help. I won't have time to look at this until later today. I will let you know what happens.
Is this a bug in the framework or the theme?
Thanks
Brett
-
AuthorPosts