Skip to content

Instantly share code, notes, and snippets.

@temsool
Created October 30, 2018 14:37
Show Gist options
  • Save temsool/1ccafb5ac4ef3679e3c2e647cf6cf6c8 to your computer and use it in GitHub Desktop.
Save temsool/1ccafb5ac4ef3679e3c2e647cf6cf6c8 to your computer and use it in GitHub Desktop.
portfolio dynamic hover caption post title
<?php
add_action('elementor/widget/render_content', function( $content, $widget ) {
$settings = $widget->get_settings();
if (strpos($settings['_css_classes'], "portfolio-image") !== false) {
$caption = get_the_title(get_the_ID());
$link=get_permalink(get_the_ID());
$content .= '<a class="portfolio-hover" target="_blank" href="'.$link.'">' . $caption . '</a>';
}
return $content;
}, 10, 2);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment