Community Forums › Forums › Archived Forums › Design Tips and Tricks › Portfolio possible in 411 Pro Theme?
- This topic has 11 replies, 4 voices, and was last updated 11 years, 1 month ago by
Henrik Blomgren.
-
AuthorPosts
-
January 1, 2014 at 5:18 am #82458
Sjoerd Smeets
ParticipantHello, i was trying to make a portfolio page within 411 Pro theme using the instructions of http://wpsites.net/web-design/add-responsive-portfolio-page-to-lifestyle-pro/ and trying to adapt these for the 411 Pro theme, but that doesn't work as intended. Doesa anyone have an idea how to approach this?
The page a now have pulls all posts from a CPT called photoblog where i import Instagram photo's from 2 accounts using a plugin. I want to show a few photos per page (with pagination) instead of just all the links (see included url).
Thanks!
http://www.veermakelol.nl/fotoblog/January 1, 2014 at 5:46 am #82459Brad Dalton
ParticipantYes. What doesn't work as intended?
The tutorial you linked to works on another theme ( Lifestyle Pro) and wasn't written specifically to work on the 411 Pro theme.
Maybe this tutorial will help because not all themes use the same code http://wpsites.net/web-design/add-portfolio-page-to-411-theme-by-studiopress/
Please clarify what you mean by this:
The page a now have pulls all posts from a CPT called photoblog where i import Instagram photo’s from 2 accounts using a plugin.
As long as the imported images are saved as featured images for your single CPT's, they should display on your Portfolio CPT archive page.
January 1, 2014 at 6:20 am #82460Sjoerd Smeets
ParticipantThey are not saved as featured images, they go directly into the post itself.
Is it possible without the featured image?January 1, 2014 at 6:34 am #82463Sjoerd Smeets
ParticipantWhen i follow you're instructions and want to save the permalinks i get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/vml2011/domains/veermakelol.nl/public_html/wp-content/themes/the-411-pro/functions.php:1) in /home/vml2011/domains/veermakelol.nl/public_html/wp-includes/pluggable.php on line 896
January 1, 2014 at 6:50 am #82465Brad Dalton
ParticipantWorked perfectly for me
Where exactly in the functions file did you paste the code?
Here are the instructions on the tutorial i linked to. If you just paste the code anywhere it may not work.
Add PHP To Functions File
Note: Please copy all the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++
January 1, 2014 at 7:09 am #82466stinkykong
ParticipantI took a different approach to adding what might give you what you're looking for. What I did was not really a portfolio using a custom post type but rather creating a separate category and using CSS to resize and float the listings as I wanted.
My example is:
http://websentia.com/category/web-portfolio/You might not call it "elegant" but it gave me what I wanted for this one particular instance. You could also use CSS to hide the featured images if desired, leaving them visible in other category archives. (Before StudioPress offered portfolios in some of their themes, I was accustomed to Wes Straham's method at AppFinite, where your portfolio was not separate from the flow of other posts and would include text snippets. I'm still sort of caught in between the two methods. BTW, Brad is always helpful and gives a lot of good information. Kudos to Brad.)
Here's the CSS I used:
.category-web-portfolio .entry {
width: 100%;
max-width: 370px;
float: left;
margin: 20px 5px;
height: auto;
}
.category-web-portfolio .entry-header {
height: 70px;
overflow: hidden;
}
.category-web-portfolio .category-web-portfolio .entry-header h2 {
font-size: 2.5rem;
}
.category-web-portfolio .category-web-portfolio .entry-content {
height: 550px;
overflow: hidden;
}
.home .category-web-portfolio .entry-content {
height: auto;
overflow: hidden;
}
.category-web-portfolio .entry-content a:hover, .category-web-portfolio .entry-header a:hover {
opacity: 0.7;
}
Web Design by Websentia Web Services
http://websentia.comJanuary 2, 2014 at 12:08 am #82629Sjoerd Smeets
Participantfunctions.php
/<?php //* Start the engine include_once( get_template_directory() . '/lib/init.php' ); //* Set Localization (do not remove) load_child_theme_textdomain( 'the-411', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'the-411' ) ); //* Child theme (do not remove) define( 'CHILD_THEME_NAME', __( 'The 411 Pro Theme', 'the-411' ) ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/the-411/' ); define( 'CHILD_THEME_VERSION', '1.0' ); //* Add HTML5 markup structure add_theme_support( 'html5' ); //* Add viewport meta tag for mobile browsers add_theme_support( 'genesis-responsive-viewport' ); //* Enqueue Google fonts add_action( 'wp_enqueue_scripts', 'the_411_google_fonts' ); function the_411_google_fonts() { wp_enqueue_style( 'google-font', '//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400|Roboto+Slab:300,400', array(), CHILD_THEME_VERSION ); } //* Enqueue Backstretch script and prepare images for loading add_action( 'wp_enqueue_scripts', 'the_411_enqueue_scripts' ); function the_411_enqueue_scripts() { wp_enqueue_script( 'the-411-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' ); //* Load scripts only if custom background is being used if ( ! get_background_image() ) return; wp_enqueue_script( 'the-411-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_script( 'the-411-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'the-411-backstretch' ), '1.0.0' ); wp_localize_script( 'the-411-backstretch-set', 'BackStretchImg', array( 'src' => str_replace( 'http:', '', get_background_image() ) ) ); } //* Add support for custom background add_theme_support( 'custom-background', array( 'wp-head-callback' => 'the_411_background_callback' ) ); //* Add custom background callback for background color function the_411_background_callback() { if ( ! get_background_color() ) return; printf( '<style>body { background-color: #%s; }</style>' . "\n", get_background_color() ); } //* Add support for custom header add_theme_support( 'custom-header', array( 'width' => 200, 'height' => 60, 'header-selector' => '.site-title a', 'header-text' => false, ) ); //* Add support for post formats add_theme_support( 'post-formats', array( 'quote', ) ); //* Add support for 2-column footer widgets add_theme_support( 'genesis-footer-widgets', 2 ); //* Unregister layout settings genesis_unregister_layout( 'content-sidebar' ); genesis_unregister_layout( 'sidebar-content' ); genesis_unregister_layout( 'content-sidebar-sidebar' ); genesis_unregister_layout( 'sidebar-sidebar-content' ); genesis_unregister_layout( 'sidebar-content-sidebar' ); //* Unregister primary/secondary navigation menus remove_theme_support( 'genesis-menus' ); //* Unregister sidebars unregister_sidebar( 'sidebar' ); unregister_sidebar( 'sidebar-alt' ); //* Force full-width-content layout setting add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' ); //* Remove elements with post formats add_action( 'genesis_before_entry', 'the_411_remove_elements' ); function the_411_remove_elements() { //* Remove if post has format if ( get_post_format() ) { add_filter( 'genesis_pre_get_option_content_archive', 'the_411_format_content' ); add_filter( 'genesis_pre_get_option_content_archive_limit', 'the_411_content_limit' ); add_filter( 'genesis_pre_get_option_content_archive_thumbnail', '__return_false' ); remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); } //* Add back, as post has no format else { remove_filter( 'genesis_pre_get_option_content_archive', 'the_411_format_content' ); remove_filter( 'genesis_pre_get_option_content_archive_limit', 'the_411_content_limit' ); remove_filter( 'genesis_pre_get_option_content_archive_thumbnail', '__return_false' ); add_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); add_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); add_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); add_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); add_action( 'genesis_entry_footer', 'genesis_post_meta' ); } } function the_411_format_content() { return 'full'; } function the_411_content_limit() { return '0'; } //* Hook social icons and click here widget areas add_action( 'genesis_after_header', 'the_411_extras' ); function the_411_extras() { if ( is_active_sidebar( 'social-icons' ) || is_active_sidebar( 'click-here' ) ) { echo '<div class="site-extras">'; genesis_widget_area( 'social-icons', array( 'before' => '<div class="social-icons">', 'after' => '</div>' ) ); genesis_widget_area( 'click-here', array( 'before' => '<div class="click-here">', 'after' => '</div>' ) ); echo '</div>'; } } //* Hook welcome message widget area before content add_action( 'genesis_before_loop', 'the_411_welcome_message' ); function the_411_welcome_message() { if ( ! is_front_page() || get_query_var( 'paged' ) >= 2 ) return; genesis_widget_area( 'welcome-message', array( 'before' => '<div class="welcome-message widget-area">', 'after' => '</div>', ) ); } //* Remove entry meta in entry footer add_action( 'genesis_before_entry', 'the_411_remove_entry_meta' ); function the_411_remove_entry_meta() { //* Remove if not single post if ( ! is_single() ) { remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 ); remove_action( 'genesis_entry_footer', 'genesis_post_meta' ); remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 ); } } //* Hook after post widget after the entry content add_action( 'genesis_after_entry', 'the_411_after_entry', 5 ); function the_411_after_entry() { if ( is_singular( 'post' ) ) genesis_widget_area( 'after-entry', array( 'before' => '<div class="after-entry widget-area">', 'after' => '</div>', ) ); } //* Modify the WordPress read more link add_filter( 'the_content_more_link', 'the_411_read_more' ); function the_411_read_more() { return '<a class="more-link" href="' . get_permalink() . '">' . __( 'Continue Reading', 'the_411' ) . '</a>'; } //* Modify the content limit read more link add_action( 'genesis_before_loop', 'the_411_more' ); function the_411_more() { add_filter( 'get_the_content_more_link', 'the_411_read_more' ); } add_action( 'genesis_after_loop', 'the_411_remove_more' ); function the_411_remove_more() { remove_filter( 'get_the_content_more_link', 'the_411_read_more' ); } //* Remove comment form allowed tags add_filter( 'comment_form_defaults', 'the_411_remove_comment_form_allowed_tags' ); function the_411_remove_comment_form_allowed_tags( $defaults ) { $defaults['comment_notes_after'] = ''; return $defaults; } //* Modify the size of the Gravatar in the author box add_filter( 'genesis_author_box_gravatar_size', 'the_411_author_box_gravatar' ); function the_411_author_box_gravatar( $size ) { return 140; } //* Modify the size of the Gravatar in the entry comments add_filter( 'genesis_comment_list_args', 'the_411_comments_gravatar' ); function the_411_comments_gravatar( $args ) { $args['avatar_size'] = 96; return $args; } //* Register widget areas genesis_register_sidebar( array( 'id' => 'welcome-message', 'name' => __( 'Welcome Message', 'the_411' ), 'description' => __( 'This is the welcome message widget area.', 'the_411' ), ) ); genesis_register_sidebar( array( 'id' => 'social-icons', 'name' => __( 'Social Icons', 'the_411' ), 'description' => __( 'This is the social icons widget area.', 'the_411' ), ) ); genesis_register_sidebar( array( 'id' => 'click-here', 'name' => __( 'Click Here', 'the_411' ), 'description' => __( 'This is the click here widget area.', 'the_411' ), ) ); genesis_register_sidebar( array( 'id' => 'after-entry', 'name' => __( 'After Entry', 'the_411' ), 'description' => __( 'This is the after entry widget area.', 'the_411' ), ) ); //* Add a custom post type Recepten add_action( 'init', 'recipe_post_type' ); function recipe_post_type() { // Portfolio custom post type register_post_type( 'recepten', array( 'labels' => array( 'name' => __( 'Recepten' ), 'singular_name' => __( 'Recepten' ), ), 'has_archive' => true, 'public' => true, 'show_ui' => true, // defaults to true so don't have to include 'show_in_menu' => true, // defaults to true so don't have to include 'rewrite' => array( 'slug' => 'recepten' ), 'supports' => array( 'title', 'editor', 'comments', 'genesis-seo', 'thumbnail','genesis-cpt-archives-settings' ), ) ); } //* Add a custom post type Photoblog add_action( 'init', 'photoblog_post_type' ); function photoblog_post_type() { // Portfolio custom post type register_post_type( 'photoblog', array( 'labels' => array( 'name' => __( 'Photoblog' ), 'singular_name' => __( 'photoblog' ), ), 'has_archive' => true, 'public' => true, 'show_ui' => true, // defaults to true so don't have to include 'show_in_menu' => true, // defaults to true so don't have to include 'rewrite' => array( 'slug' => 'photoblog' ), 'supports' => array( 'title', 'editor', 'comments', 'genesis-seo', 'thumbnail','genesis-cpt-archives-settings' ), ) ); } //* Vanaf hier aanpassingen voor grid view photoblog //* Create portfolio custom post type add_action( 'init', 'executive_portfolio_post_type' ); function executive_portfolio_post_type() { register_post_type( 'portfolio', array( 'labels' => array( 'name' => __( 'Portfolio', 'executive' ), 'singular_name' => __( 'Portfolio', 'executive' ), ), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => get_stylesheet_directory_uri() . '/lib/icons/portfolio.png', 'public' => true, 'rewrite' => array( 'slug' => 'portfolio', 'with_front' => false ), 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'revisions', 'page-attributes', 'genesis-seo', 'genesis-cpt-archives-settings' ), 'taxonomies' => array( 'portfolio-type' ), ) ); } //* Add Portfolio Type Taxonomy to columns add_filter( 'manage_taxonomies_for_portfolio_columns', 'portfolio_columns' ); function portfolio_columns( $taxonomies ) { $taxonomies[] = 'portfolio-type'; return $taxonomies; } //* Change the number of portfolio items to be displayed (props Bill Erickson) add_action( 'pre_get_posts', 'executive_portfolio_items' ); function executive_portfolio_items( $query ) { if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) { $query->set( 'posts_per_page', '8' ); } } //* Customize Portfolio post info and post meta add_filter( 'genesis_post_info', 'executive_portfolio_post_info_meta' ); add_filter( 'genesis_post_meta', 'executive_portfolio_post_info_meta' ); function executive_portfolio_post_info_meta( $output ) { if( 'portfolio' == get_post_type() ) return ''; return $output; } //* Load Admin Stylesheet add_action( 'admin_enqueue_scripts', 'executive_load_admin_styles' ); function executive_load_admin_styles() { wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/lib/admin-style.css', false, '1.0.0' ); wp_enqueue_style( 'custom_wp_admin_css' ); } //* Create Portfolio Type custom taxonomy add_action( 'init', 'executive_type_taxonomy' ); function executive_type_taxonomy() { register_taxonomy( 'portfolio-type', 'portfolio', array( 'labels' => array( 'name' => _x( 'Types', 'taxonomy general name', 'executive' ), 'add_new_item' => __( 'Add New Portfolio Type', 'executive' ), 'new_item_name' => __( 'New Portfolio Type', 'executive' ), ), 'exclude_from_search' => true, 'has_archive' => true, 'hierarchical' => true, 'rewrite' => array( 'slug' => 'portfolio-type', 'with_front' => false ), 'show_ui' => true, 'show_tagcloud' => false, ) ); }
January 2, 2014 at 12:22 am #82630Sjoerd Smeets
ParticipantWhen i pasted the code of functions.php i saw the flaw..
Imported all Instagram photo's to the new portfolio CPT and created the page. Works like a charm!
Thanks Brad.January 2, 2014 at 3:55 am #82639Brad Dalton
ParticipantJanuary 9, 2014 at 1:44 am #84134Henrik Blomgren
MemberIf I copy the creation of the portfolio custom post type with
//* Create Portfolio Type custom taxonomy add_action( 'init', 'executive_type_taxonomy' ); function executive_type_taxonomy() { register_taxonomy( 'portfolio-type', 'portfolio', array( 'labels' => array( 'name' => _x( 'Types', 'taxonomy general name', 'executive' ), 'add_new_item' => __( 'Add New Portfolio Type', 'executive' ), 'new_item_name' => __( 'New Portfolio Type', 'executive' ), ), 'exclude_from_search' => true, 'has_archive' => true, 'hierarchical' => true, 'rewrite' => array( 'slug' => 'portfolio-type', 'with_front' => false ), 'show_ui' => true, 'show_tagcloud' => false, ) ); }
And then when I create posts from this CPT I get a 404 when I try to view the single CPT type portfolio. Why is this?
January 9, 2014 at 10:43 pm #84314Brad Dalton
ParticipantThe single cpt must use the same name as the cpt so single.portfolio.php will work for a CPY named portfolio.
The screenshot proves it works and it snot difficult.
The code you pasted above isn't for the CPT, its for the taxonomy support.
January 9, 2014 at 10:59 pm #84320Henrik Blomgren
MemberAHA so that´s why when using rewrite and not having a single-cpt.php it turns out to call a 404. Then I understand.
And yes, when I look at it indeed it´s the taxonomy support and not creating the CPT. I must have been extremely tired when copying that snippet of code. My bad. I´ll change the code and write a single-portfolio.php and if that doesn´t work i´ll come back.
Thanks for the help Brad!
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.