Default image on portfolio

Hello,

Currently, the default image of a project in the Portfolio plugin is set to use the featured image assigned in the individual project. I would like to change that so the custom header image appears in the portfolio instead.

Thank you,

Lilou

Hello Lilou,

To accomplish such that objective, please follow the below steps.

Prepare an image which you wish to alter the default featured image in a single project page. Edit one of your project, then upload it to the content editor and put it in the first line.

Now we’ll fetch this first image to alter the default featured image, which can be done by doing this:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box

jQuery(function($) {

  if( $('body').hasClass('single-projects') ) {

    var newImage = $('.entry-content').find('img').first();

    $('.entry-thumb').append(newImage);
  
  }

});

  1. Update

  2. Then add this piece of extra custom CSS code to Appearance > Customize > Additional CSS to remove the default featured image.


.single-projects .entry-thumb img:first-child {
  display: none;
}

Regards,
Kharis

Hello Kharis,

I want to do this for all my projects. The solution likely works, but sounds quite complexe for 20 or so projects. Maybe there is a simpler solution?

If I set the desired image in both custom header and featured image, it will appear in the portfolio as desired and also in the header of the post page where I also want it. Would hiding the featured image from the page it opens when clicked in the portfolio be easier? If so, could this custom setting be set for all projects of a particular category?

Thank you,

Lilou.

What is the code necessary to hide the featured image on the post page only? Since the page itself does no exist I don’t know what code or where to put it. See previous post for more détails.

Hello there,

I am not sure if there’s an easy solution to enable them at once route. Ideally, you’ll need to write a custom plugin for such this kind of purpose.

> Would hiding the featured image from the page it opens when clicked in the portfolio be easier?

The code I’ve provided is the easiest to do. But, it requires some more efforts to manually upload the new image in the first line of editor box.

Regards,
Kharis