Customizing jetpack portfolio shortcode
-
Hello
I have customised the code in /jetpack/modules/custom-post-types/portfolios.php to display the projects in a bootstrap theme framework.
Is there any way that I can put this code somewhere else to prevent it being overwritten by a jetpack upgrade?Cheers
-
Instead of editing plugin files, I would recommend that you place your code in a separate plugin, or in your theme. You should be able to customize most functions via filters. If you find that a filter is missing, let me know and we’ll add it to the Jetpack in the next release!
This was set as “resolved”, but I don’t see what was done. I would like to override the template layout for varying columns and rows to utilize the Bootstrap framework as well (especially for responsive layout), but to also customize the layout based on what is entered in the shortcode.
I have to say, this jetpack portfolio is a major plus. As a side note, I did manage to setup a archive-jetpack-portfolio.php override…just need the column layout now (somehow).
I would like to override the template layout
[…]
I did manage to setup a archive-jetpack-portfolio.php overrideJetpack itself doesn’t create any templates for the Custom Post Type. It uses your theme’s template files. You can consequently create new template files for each Custom Post Type view. You already created a custom template for the Archive view. You can also create one for single post views, named
single-jetpack-portfolio.php. You can add columns and customize the look of each template with CSS, within your theme.Sorry, I meant I made a single-jetpack-portfolio.php file, not the archive one, my mistake. The archive version can work separately, but. I was referring to the method of using the portfolio shortcode in a page template. The jetpack plugin sets the layout structure, and is the part I want to customize if someone wants to use the shortcode method instead of the archive method via menu item for a Project Type. These are two different layouts, the shortcode gives you columns in a standard page template, but the menu item for a project type gives you an archive type layout via the theme’s archive template (or a archive-jetpack-portfolio.php). Ultimately the goal is to have it so both methods of displaying project items can look and function the same.
I can start a new topic for this if necessary, as this one is already set as resolved…?
You should be able to customize the look of the Portfolio shortcode with CSS, and by using the different shortcode attributes. You can for example control the number of columns thanks to the
columnsshortcode parameter. You can also change the width of each post by applying custom CSS and using the.portfolio-entryclass.You can look at how the shortcode was customized in the Illustratr theme, for example:
https://themes.trac.wordpress.org/browser/illustratr/1.1.4/style.css#L2819This theme also uses a custom
single-jetpack-portfolio.php, as well as a custom view for Portfolio items in the content loop:- https://themes.trac.wordpress.org/browser/illustratr/1.1.4/single-jetpack-portfolio.php
- https://themes.trac.wordpress.org/browser/illustratr/1.1.4/content-portfolio-single.php
All in all, it really is up to the theme. You decide how portfolio items will look like there.
Is there a filter for the shortcode function output of [portfolio]?
@saskia No, we didn’t add any filter to customize the ouput of the shortcode.
https://github.com/Automattic/jetpack/blob/3.5.3/modules/custom-post-types/portfolios.php#L393
https://github.com/Automattic/jetpack/blob/3.5.3/modules/custom-post-types/portfolios.php#L521We could add one, though! Could you create a GitHub issue with an example of the things you’d like to customize, or create your own thread here, as per the Forum Welcome?
http://wordpress.org/support/plugin/jetpack#postformThank you!
Hi
I also was surfing web about customize jetpack portfolio and after reading this topic, understood that by editing “portfolio.php” file in “\modules\custom-post-types” folder portfolio shotcode is customizable.I found following code:
static function portfolio_shortcode( $atts ) { // Default attributes $atts = shortcode_atts( array( 'display_types' => true, 'display_tags' => true, 'display_content' => true, 'show_filter' => false, 'include_type' => false, 'include_tag' => false, 'columns' => 2, 'showposts' => -1, 'order' => 'asc', 'orderby' => 'date', ), $atts, 'portfolio' );and changed “true” options to “false” and now use shortcode for displaying only thumbnail images. that’s so easy š
@jeremy may you add this option in setting page in the next release?
thanks@m.Javad You do not need to edit the plugin files to change the shortcode parameters. You can change these values when adding the shortcode to your posts or pages, as explained here:
https://en.support.wordpress.com/portfolios/portfolio-shortcode/Github filter request added
https://github.com/Automattic/jetpack/issues/2194Thanks Jeremy!
The topic ‘Customizing jetpack portfolio shortcode’ is closed to new replies.