Forum Replies Created
-
AuthorPosts
-
Elizabeth Kricfalusi
MemberI decided I was spending way too much time on this, so I decided just to go in and change the plugin function so that book-tag is hierarchical and supports parent categories. It serves my purpose that way and if there's ever a plugin upgrade, it will be an easy enough fix.
Thanks for your help, Brad. Hopefully the solution you came up with can be used by others who run into the same problem.
Elizabeth Kricfalusi
MemberWow, I wasn't expecting anyone to spend as much time as me on this. I figured actual developers would see my mistakes right off! 🙂
I'm off to check out the response, but I wasn't sure if you were still wondering what I used to create the Genre taxonomy, so I'm putting it here just in case.
/* Register Custom Taxonomies: Book Genres */ function add_custom_taxonomies_book_genres() { // Add new "Book Genres" taxonomy to Books register_taxonomy('book-genres', 'books', array( // Hierarchical taxonomy (like categories) 'hierarchical' => true, // This array of options controls the labels displayed in the WordPress Admin UI 'labels' => array( 'name' => _x( 'Book Genres', 'taxonomy general name', 'author-pro'), 'singular_name' => _x( 'Book Genre', 'taxonomy singular name', 'author-pro' ), 'search_items' => __( 'Search Book Genres', 'author-pro' ), 'all_items' => __( 'All Book Genres', 'author-pro' ), 'edit_item' => __( 'Edit Book Genre', 'author-pro' ), 'update_item' => __( 'Update Book Genre', 'author-pro' ), 'add_new_item' => __( 'Add New Book Genre', 'author-pro' ), 'new_item_name' => __( 'New Book Genre Name', 'author-pro' ), 'menu_name' => __( 'Genres', 'author-pro' ), 'parent_item' => __( 'Parent Book Genre', 'author-pro' ), 'parent_item_colon' => __( 'Parent Book Genre:', 'author-pro' ), ), 'public' => true, 'show_ui' => true, 'query_var' => true, 'show_admin_column' => true, // Control the slugs used for this taxonomy 'rewrite' => array( 'slug' => 'book-genre', // This controls the base slug that will display before each term 'with_front' => false, // Don't display the category base before "/book-genre/" 'hierarchical' => true // This will allow URL's like "/book-genre/suspense/" ), )); } add_action( 'init', 'add_custom_taxonomies_book_genres', 0 ); I'll report back whether I can get your solution to work for me as well. Thanks!
July 5, 2015 at 10:51 am in reply to: Author Pro – Apply Archive Template to Custom Taxonomy #158416Elizabeth Kricfalusi
MemberThanks, Brad, for those suggestions and links. Unfortunately, I still haven't been able to get any of them to work.
This is the full contents of taxonomy-books-genre.php:
<?php /** * This file adds the book genre taxonomy archive template to the Genesis Author Pro plugin. * * @author StudioPress * @package Genesis Author Pro * @subpackage Template */ //* Uses the default book post type archive template file require_once( GENESIS_AUTHOR_PRO_TEMPLATES_DIR . 'archive-books.php' );
This is the full content of archive-books.php:
<?php /** * This file adds the book(library) archive template to the Genesis Author Pro plugin. * * @author StudioPress * @package Genesis Author Pro * @subpackage Template */ add_action( 'wp_enqueue_scripts', 'genesis_author_pro_load_default_styles' ); add_action( 'genesis_loop', 'genesis_author_pro_setup_archive_loop', 9 ); //* Add author_pro body class to the head add_filter( 'body_class', 'genesis_author_pro_add_body_class' ); add_filter('post_class' , 'genesis_author_pro_custom_post_class'); genesis();
When I put those files in the Author Pro theme folder, I get these error messages:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'genesis_author_pro_load_default_styles' not found or invalid function name in /home3/ab19133/public_html/jlc/wp-includes/plugin.php on line 496
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'genesis_author_pro_add_body_class' not found or invalid function name in /home3/ab19133/public_html/jlc/wp-includes/plugin.php on line 213
Catchable fatal error: Argument 1 passed to genesis_custom_body_class() must be of the type array, null given in /home3/ab19133/public_html/jlc/wp-content/themes/genesis/lib/structure/layout.php on line 61
I also tried removing taxonomy-books-genre.php from the folder (hoping that the built-in hierarchy would kick in), but I get the same messages.
The first two messages seem like the problem is that the template file is calling functions from within the plugin folder so it can't find them. Does that make sense? And if so, how do I solve that? I obviously don't want to copy over all the functions from the plugin folder to the theme folder. Not sure what the third message means.
I tried the include method as well. It didn't give me any errors, but it didn't apply the template either. I'm not sure, however, if I've customized the function correctly for my circumstances. This is the function I've put into functions.php:
function custom_books_archive_page_template( $template ) { if ( is_archive( 'book-genres' ) ) { $new_template = locate_template( array( 'archive-books.php' ) ); if ( '' != $new_template ) { return $new_template ; } } return $template; } add_filter( 'template_include', 'custom_books_archive_page_template', 99 );
I can make this work with the book-tag taxonomy, but it's not ideal because existing tags don't show up in a list like categories do in the admin screen. If there's any chance of an enhancement request for this theme, it would be to add Genre as a category-style taxonomy since it and Author are probably the two main things people are looking for when buying books.
June 29, 2015 at 10:12 am in reply to: Author Pro – Apply Archive Template to Custom Taxonomy #157842Elizabeth Kricfalusi
MemberThanks to Genesis Developer who replied to me with a suggestion previously, although it seems to have been deleted now.
Unfortunately I got caught up with other jobs and had to put this on the back burner a bit.
I did look back at the email, though, and the suggested plugin was not what I need.
There is already a template for the archive page I want to use. I just can't get it to apply to the new taxonomy I created. I've tried hard-coding the URL to the template and that didn't work. I tried adding the new taxonomy into the construct function in the CPT class file, but that didn't work.
Here is an example of how I want the page to look. It uses the plugin's built-in book-tag taxonomy:
http://jlc.t4lsites.com/book-tag/suspense/
Here is how it looks with my custom book-genre taxonomy:
http://jlc.t4lsites.com/book-genre/suspense/
Again, if anyone can provide any guidance of what I'm doing wrong, that would be greatly appreciated!
Elizabeth
Elizabeth Kricfalusi
MemberI'm trying to do the same thing as the OP. Is there a tutorial anywhere that shows what needs to be done to use the widgetized home page template for other pages? If not, can you share what the basic steps are for doing this? I'm just not sure how to get started, e.g. do I need to make a copy of the front-page.php file and replace all the instances of "home" in it to the thing I want to make the page about? Will that add a whole bunch of new widgets to my widgets screen for each page?
I'm using Lifestyle Pro.
Thanks!
Elizabeth Kricfalusi
MemberThanks to both of you for your quick and clear replies!
-
AuthorPosts