• Howdy all,

    Pertinent backstory: Relatively new to web development in general, first WordPress project, designing a portfolio site for a friend of mine. I’d like to have a home page with thumbnails that correspond to the various portfolio categories (e.g. landscapes, portraits, macro, etc.), which will then take the user to all the images for that category. I’ve seen others attempt/accomplish this, and I’ve also seen a workaround detailed by the theme creator that would pull the most recently added picture for each portfolio category and make THAT the thumbnail. My approach so far has been to create a custom post type with a title and a featured image, copy/rename the full-width portfolio template into my child theme folder, and then modify the query in the template to look for only that custom post-type (which will only consist of the 6 or so images I want on the homepage). This returns the correct content, but the only way to get it to display properly (i.e. the way the regular full-width portfolio template does), is by adding my template file to the portfoliopress_body_class() function in portfolio-press/extensions/portfolio-helpers.php.

    Question: It doesn’t seem like a best practice to go around editing the core theme like this. Is there a better way?

    Thank you for your time.

Viewing 1 replies (of 1 total)
  • Thread Starter jcubed

    (@jcubed)

    Follow up: I ended up just copying the portfoliopress_body_class() function (with the add_filter()) into my child theme’s functions.php file, adding my template to the list, and renaming it. Seems to work just fine. I also changed my approach a bit. Instead of creating a custom post type, I just added a custom field to the posts in question and added the meta_key parameter to the query instead.

    To get the thumbnail image to link to the appropriate portfolio-category page, I added

    $catpath = '/portfolio-category/' . get_post_meta( get_the_ID(), 'portcat', true);

    And then for the href value I replaced the_permalink(); with:
    <?php echo esc_url( home_url( $catpath ) ); ?>

    If there’s a more secure way to go about this I’m all ears.

Viewing 1 replies (of 1 total)
  • The topic ‘Modifying portfolio-helpers.php?’ is closed to new replies.