Want to show image caotion or title above portfolio image - wordpress

For a recently developed wordpress website http://stc.co.in, I'm using Huge-IT portfolio to show the projects in each sectors. On clicking on projects a popup is showing with multiple images. Now I want to show image caption or title above the big image which was added while uploading image through WordPress. Please guide how to achieve this.
Thanks in advance.
Regards, Sanjay

If the plugin cant let you do it simply with text editor, in wordpress you need to search the specific section you want and work on php file.
When you have founded it you can put an html section with your title.

you need to made changes in plugin file..
follow path :
wordpress-sitename/wp-content/plugins/portfolio-gallery/Front_end/portfolio_front_end_view.php
modify line :
<ul id="huge_it_portfolio_popup_list_<?php echo $portfolioID; ?>">
<?php
foreach($images as $key=>$row)
{
$imgurl=explode(";",$row->image_url);
array_pop($imgurl);
$link = $row->sl_url;
$descnohtml=strip_tags($row->description);
$result = substr($descnohtml, 0, 50);
?>
<li class="pupup-element" id="huge_it_portfolio_pupup_element_<?php echo $row->id; ?>">
<div class="heading-navigation_<?php echo $portfolioID; ?>">
<div style="clear:both;"></div>
</div>
<div class="popup-wrapper_<?php echo $portfolioID; ?>">
<div class="image-block_<?php echo $portfolioID; ?>">
<?php if($paramssld["ht_view2_show_popup_title"]=='on'){?><h3 class="title"><?php echo $row->name; ?></h3><?php } ?>
<?php if($row->image_url != ';'){ ?>
<img alt="<?php echo $row->name; ?>" id="wd-cl-img<?php echo $key; ?>" src="<?php echo $imgurl[0]; ?>" />
<?php
global $wpdb;
$cimg_url = $imgurl[0];
$attachment = $wpdb->get_results("SELECT ID FROM wp_posts WHERE guid='".$cimg_url."'",'ARRAY_A');
$attachment_title = get_the_title($attachment[0]['ID']);
?>
<div class="cls_img_ttl" id="main_img_ttl"><?php echo $attachment_title; ?></div>
<?php } else { ?>
<img alt="<?php echo $row->name; ?>" id="wd-cl-img<?php echo $key; ?>" src="images/noimage.jpg" />
<?php
} ?>
</div>
<div class="right-block">
<?php if($paramssld["ht_view2_show_popup_title"]=='on'){?><h3 class="title"><?php echo $row->name; ?></h3><?php } ?>
<?php if($paramssld["ht_view2_thumbs_position"]=='before' and $paramssld["ht_view2_show_thumbs"] == 'on'){?>
<div><ul class="thumbs-list_<?php echo $portfolioID; ?>">
<?php
global $wpdb;
foreach($imgurl as $key=>$img){
$cimg_url = $img;
$attachment = $wpdb->get_results("SELECT ID FROM wp_posts WHERE guid='".$cimg_url."'",'ARRAY_A');
$attachment_title = get_the_title($attachment[0]['ID']);
?>
<li><a href="<?php echo $row->sl_url; ?>" class="group1" data-ttl="<?php echo $attachment_title; ?>" >
<img src="<?php echo $img; ?>">
</a></li>
<?php } ?>
</ul></div>
<?php } ?>
<?php if($paramssld["ht_view2_show_description"]=='on'){?><div class="description"><?php echo $row->description; ?></div><?php } ?>
<?php if($paramssld["ht_view2_thumbs_position"]=='after' and $paramssld["ht_view2_show_thumbs"] == 'on'){?>
<div><ul class="thumbs-list_<?php echo $portfolioID; ?>">
<?php $imgurl=explode(";",$row->image_url);array_pop($imgurl);
foreach($imgurl as $key=>$img){?>
<li><img src="<?php echo $img; ?>"></li>
<?php } ?>
</ul></div>
<?php } ?>
<?php if($paramssld["ht_view2_show_popup_linkbutton"]=='on'){?>
<div class="button-block">
<a href="<?php echo $link; ?>" <?php if ($row->link_target=="on"){echo 'target="_blank"';}?>><?php echo $paramssld["ht_view2_popup_linkbutton_text"]; ?></a>
</div>
<?php } ?>
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>
</div>
</li>
<?php
}?>
</ul>
JS:
jQuery('#huge_it_portfolio_popup_list_<?php echo $portfolioID; ?> .popup-wrapper_<?php echo $portfolioID; ?> .right-block ul.thumbs-list_<?php echo $portfolioID; ?> li a').click(function(){
var width=jQuery(window).width();
if(width<=767){
jQuery('body').scrollTop(0);
}
jQuery(this).parent().parent().find('li.active').removeClass('active');
jQuery(this).parent().addClass('active');
var main_img_ttl = jQuery(this).attr('data-ttl');
alert(main_img_ttl);
jQuery(this).parents('.right-block').prev().find('.cls_img_ttl').html(main_img_ttl);
jQuery(this).parents('.right-block').prev().find('img').attr('src',jQuery(this).find('img').attr('src'));
return false;
});
you can download file here : LINK

Related

How to ignore a click on a Gutenberg block that is wrapped with a link tag?

I have created a custom Gutenberg block that is basically a link. When I click the block in the editor I immediately get sent to the page the block links to instead of being able to edit the block. How do I stop this from happening? I've already tried putting pointer-events: none as a style on it but that doesn't do anything surprisingly.
<a href="<?php the_field('link') ?>" id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($className); ?> <?php echo esc_attr($layout); ?>">
<div class="icon_callout_content">
<div class="off_content">
<div class="color_callout_icon">
<img src="<?php echo $icon ?>" height="<?php if($iconHeight){ echo $iconHeight . "px"; } ?>">
</div>
<h3><?php echo $title ?></h3>
</div>
<div class="hover_content">
<?php echo $description ?>
</div>
</div>
</a>
Since this may help others in the future, wrap your <a> tag in an if statement to check if your in the admin area. If you are, then it won't output those tags.
<?php if ( ! is_admin() ) : ?>
<a href="<?php the_field('link') ?>" id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($className); ?> <?php echo esc_attr($layout); ?>">
<?php endif; ?>
<div class="icon_callout_content">
<div class="off_content">
<div class="color_callout_icon">
<img src="<?php echo $icon ?>" height="<?php if($iconHeight){ echo $iconHeight . "px"; } ?>">
</div>
<h3><?php echo $title ?></h3>
</div>
<div class="hover_content">
<?php echo $description ?>
</div>
</div>
<?php if ( ! is_admin() ) : ?>
</a>
<?php endif; ?>

Wordpress - Open an Advanced Custom Field image in modal box using Featherlight.js

I have tried to code my wordpress theme as simple as possible but I don't really understand why I can't display an image from Advanced Custom Field into a modal box using Featherlight.js (http://noelboss.github.io/featherlight/)
Here is my online page http://www.skuar.com
This is my single.php code, which simply display the image custom field
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
$image = get_field('image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
and this is the wp loop content
<div id="post">
<a href ="<?php the_permalink(); ?>">
<div class="img" href="<?php
$image = get_field('image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>" data-featherlight="image">
<?php
$image = get_field('image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
</div>
</a>
</div>
I just would like to open the image in a lightbox...
Is that make sense?
Thanks!
In invalid double quotes in your code. Try this code:
<div id="post">
<a href ="<?php the_permalink(); ?>">
<div class="img" href="<?php $image = get_field('image');
if( !empty($image) ): ?>
<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>
<?php endif; ?>" data-featherlight="image">
</div>
</a>
</div>

how to display each gallery image in category page

i want to make categories gallery. so i have one category called gallery, i create some post with gallery images. in gallery category page i want to display each post 4 picture. picture will take from advancedcustomfields gallery field. bellow is my current category-gallery page code, image not coming but title and more link working fine. would guys tell me what how to do ?
<?php get_header(); ?>
<div class="contentarea">
<div class="wapper">
<div class="content clearfix">
<?php
while ( have_posts() ) :
the_post();
$images = get_field('gallery_picture');
?>
<h2><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></h2>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" /> Gallery </div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php get_footer(); ?>
i solve this problem. so want to share with other. this for category page. bellow is code
<?php
while ( have_posts() ) :
the_post();
?>
<h2><a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a></h2>
<?php
$images = get_field('gallery_picture');
$max = 5;
$i = 0;
if( $images ): ?>
<ul>
<?php foreach( $images as $image ): $i++; ?>
<?php if( $i > $max){ break; } ?>
<li> <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" /> </li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Gallery </div>
<?php endwhile; ?>

Show WordPress gallery on home like a post with easy FancyBOX

I try to show an WordPress Gallery on home page, but with the same effect present in a post page. Basically is show the gallery post on homepage when you clicking a post-thumb. I explain the problem:
When I click on post_thumb, show in the home I like this show me, a Gallery attatch in this post. This my code:
<ul id="rb-grid" class="list rb-grid">
<?php $number = 0; query_posts('category_name=atracciones-home'); if(have_posts()): ?>
<?php while(have_posts()): the_post(); ?>
<li>
<!-- <a data-fancybox-group="gallery" class="item fancybox" href="<?php the_permalink(); ?>"> -->
<a data-fancybox-group="gallery" class="item fancybox iframe" href="<?php get_attachment_link(); ?>">
<?php
if ( has_post_thumbnail() )
the_post_thumbnail('home-atracciones');
else
echo '<img src="' . trailingslashit( get_template_directory_uri() ) . 'img/default-thumbnail.png' . '" alt="" />';
?>
<div class="over" id="gallery-atracciones">
<h2 class="page-title" title="<?php the_title(); ?>"><?php the_title(); ?><span class="border"></span></h2>
</div>
</a>
</li>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
</ul>
Need to check is_home() For More Details about is_home() function Click Here
<?php
if ( is_home() ) {
// This is the blog posts index
<ul id="rb-grid" class="list rb-grid">
<?php $number = 0; query_posts('category_name=atracciones-home'); if(have_posts()): ?>
<?php while(have_posts()): the_post(); ?>
<li>
<!-- <a data-fancybox-group="gallery" class="item fancybox" href="<?php the_permalink(); ?>"> -->
<a data-fancybox-group="gallery" class="item fancybox iframe" href="<?php get_attachment_link(); ?>">
<?php
if ( has_post_thumbnail() )
the_post_thumbnail('home-atracciones');
else
echo '<img src="' . trailingslashit( get_template_directory_uri() ) . 'img/default-thumbnail.png' . '" alt="" />';
?>
<div class="over" id="gallery-atracciones">
<h2 class="page-title" title="<?php the_title(); ?>"><?php the_title(); ?><span class="border"></span></h2>
</div>
</a>
</li>
<?php endwhile; ?>
<?php endif; wp_reset_query(); ?>
</ul>
} else {
// This is not the blog posts index
get_sidebar();
}
?>

Drupal - Current page, other language

i've found this code :
<?php global $language; ?>
<?php global $theme_path; ?>
<ul class="language-switcher-locale-url">
<?php $languages = language_list() ?>
<?php foreach($languages as $lang): ?>
<?php $active = $language->language == $lang->language ? " active" : ""; ?>
<li class="<?php echo $lang->language ?><?php echo $active ?>">
<a href="/<?php echo $lang->prefix ?>">
<img src="/<?php echo $theme_path ?>/images/flags/<?php echo $lang->language ?>.png" alt="<?php echo $lang->language ?>"/>
</a>
</li>
<?php endforeach ?>
</ul>
This redirects me from mywebsite.com/de/current_page to the selected language ex. mywebsite.com/en
what can i do for my code to redirects me to mywebsite.com/en/current_page
You should try using the url() and request_path() function that Drupal provides, perhaps something like this would work:
<?php global $language; global $theme_path; $languages = language_list() ?>
<ul class="language-switcher-locale-url">
<?php foreach($languages as $lang): ?>
<?php $active = $language->language == $lang->language ? " active" : ""; ?>
<li class="<?php echo $lang->language ?><?php echo $active ?>">
<a href="<?php echo url(request_path(), array('language' => $lang)); ?>">
<img src="/<?php echo $theme_path ?>/images/flags/<?php echo $lang->language ?>.png" alt="<?php echo $lang->language ?>"/>
</a>
</li>
<?php endforeach ?>
</ul>

Resources