Masonry Portfolio: show text in overlay


#1

Hi,

My goal is to output the project title and category in the masonry portfolio overlay.

Is it possible to pass text / variables (i.e. “$project_title”) between the <span isotope overlay> tags?


#2

Hi,

yes it’s possible but you have to create a child theme to enable it.

Is it ok for you with child theme?


#3

Thanks for the reply Awan.

I’d like to explore the option of a child theme, but I don’t have any experience with child themes.

for now, i created this workaround:

  1. I added a custom Type field in Projects and called it Project-Name

  2. Then I edited the Masonry portfolio’s .PHP file, by adding this line:

$project_name = get_post_meta( get_the_ID(), 'wpcf-project-name', true );

  1. and added the output in between the <span>-brackets of the overlay. I also put the entire overlay in between nchor-tags:

<a href="' . get_the_permalink() . '"><span class="isotope-overlay">' . $project_name . '</span></a>

This workaround works for me, but this is my way to do it and I think this is not the Wordpress theme way to do it.

So, considered this problem solved, but again, I am interested in the Child Theme solution of this particular issue.

Regards,

Mark


#4

Sorry, something went wrong with formatting. This is the line I added:

<a href="' . get_the_permalink() . '"><span class="isotope-overlay">' . $project_name . '</span></a>


#5

<span class=“isotope-overlay”>’ . $project_name . '</span>


#6

Cool! that was similar with what I would to do to display the title but it’s better if you change those PHP code in child theme.

It’s simple to create a child theme, you can follow the step from here https://codex.wordpress.org/Child_Themes