Support » Plugin: Zilla Portfolio » How to change meta data for portfolio posts

  • Resolved novembergarcia

    (@novembergarcia)


    Hello! I’m not that familiar with php and the theme I’m using has your plugin…their support was a bit vague but I figured that I need to go into the Zilla Portfolio includes/functions.php (is this correct?)

    I found the section for the portfolio meta information but can’t quite figure out how to change say, the word “URL” to “Website”. Is there a way I can customize these?

    Thanks and looking forward to hearing from you soon.

    November

    https://wordpress.org/plugins/zillaportfolio/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author marksouthard

    (@mbsatunc)

    What theme are you using? It’s quite probable that this is something that can be changed within the theme files.

    I’m using a purchased theme called Base which includes this plugin because it’s a portfolio-based theme. I understand that the change must be within the plugin itself as per the description of Zilla Portfolio:

    “This plugin adds the portfolio custom post type to your WordPress blog. By default, the plugin will append portfolio meta information (client, date, and project URL) to the portfolio post. It will prepend media elements (gallery, audio and video media) to portfolio posts.”

    I would like to know how to edit the meta information so it is not limited to the words client, date and URL. Can I change a word by just replacing one of these words in the plugin’s functions.php? I am not familiar with php so I do need help. Thanks.

    Plugin Author marksouthard

    (@mbsatunc)

    You will not need to edit the plugin files. The theme has been written in a means so that you can easily overwrite the current output. Ideally, you would be using a child theme and would throw the following code in your functions.php file. If not, you can edit the template-tags.php file in the includes folder (includes/template-tags.php). The code of interest is as follows and can be copy/pasted/edited to meet your needs:

    /**
     * Build and echo the portfolio meta information
     *
     * @param  int $postid The post id
     * @since  1.0
     * @return void
     */
    function base_portfolio_meta($postid) {
    	$output = '';
    
    	$url = get_post_meta( $postid, '_tzp_portfolio_url', true);
    	$date = get_post_meta( $postid, '_tzp_portfolio_date', true);
    	$client = get_post_meta( $postid, '_tzp_portfolio_client', true);
    	$role = get_post_meta( $postid, '_zilla_broadcast_portfolio_role', true);
    
    	if( $url || $date || $client || $role ) {
    		$output .= '<div class="portfolio-entry-meta"><ul>';
    			if( $date ) {
    				$output .= sprintf( '<li><strong>%1$s</strong> <span class="portfolio-project-date">%2$s</span></li>', __('Date: ', 'zilla'), esc_html( $date ) );
    			}
    			if( $client ) {
    				$output .= sprintf( '<li><strong>%1$s</strong><span class="portfolio-project-client">%2$s</span></li>', __('Client: ', 'zilla'), esc_html( $client ) );
    			}
    			if( $role ) {
    				$output .= sprintf( '<li><strong>%1$s</strong><span class="portfolio-project-role">%2$s</span></li>', __('Role: ', 'zilla'), esc_html( $role ) );
    			}
    			if( $url ) {
    				$output .= sprintf( '<li><strong>%1$s</strong><a class="portfolio-project-url" href="%2$s">%3$s</a></li>', __('URL: ', 'zilla'), esc_url( $url ), esc_url($url) );
    			}
    
    		$output .= '</ul></div>';
    	}
    
    	echo $output;
    }

    Thank you…I played around with it (again, no php experience) and it worked! It’s great to learn something new. Thank for pointing me in the right direction (I did not use a child theme but edited the template tags). Thanks again for the support.

    lister

    (@lister)

    Im too looking at changing the meta to display ‘Project Duties Include: xxxx’ I can see the function in the includes of the theme ‘Base: template-tags.php (includes/template-tags.php)’ but I can’t work out what needs to be edited.

    after copy and pasting the above only the Portfolio Project URL / Portfolio Project Date / Portfolio Client displays. How do I edit the above so I can change the Project Date to Project Duties include? It doesn’t seem to be overwriting the default plugin function?

    Thanks

    Plugin Author marksouthard

    (@mbsatunc)

    You would change this bit __('Date: ', 'zilla') to be __('Project Duties: ', 'zilla')

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change meta data for portfolio posts’ is closed to new replies.