/**
* Forex In World – EA & Indicators Gallery
* Add with the Code Snippets plugin.
* Shortcode: [fi_ea_gallery]
*/
add_shortcode(‘fi_ea_gallery’, function () {
$cats = [
'mt4ea' => 'MT4 EA (EXPERT ADVISOR)',
'mt4indicators' => 'MT4 INDICATORS',
'mt5ea' => 'MT5 EA (EXPERT ADVISOR)',
'mt5indicators' => 'MT5 INDICATORS',
];
$active = isset($_GET['fi_cat'])
? sanitize_key(wp_unslash($_GET['fi_cat']))
: 'mt4ea';
if (!isset($cats[$active])) {
$active = 'mt4ea';
}
$search = isset($_GET['fi_search'])
? sanitize_text_field(wp_unslash($_GET['fi_search']))
: '';
$page = isset($_GET['fi_page'])
? max(1, absint($_GET['fi_page']))
: 1;
// Search across all four categories.
$query_args = [
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 10,
'paged' => $page,
'ignore_sticky_posts' => true,
'orderby' => 'date',
'order' => 'DESC',
];
if ($search !== '') {
$query_args['category_name'] = implode(',', array_keys($cats));
$query_args['s'] = $search;
} else {
$query_args['category_name'] = $active;
}
$products = new WP_Query($query_args);
$base_url = get_permalink(get_queried_object_id());
if (!$base_url) {
$base_url = home_url('/');
}
$share_url = esc_url($base_url);
ob_start();
?>
<div class="fi-gallery"
data-share-url="<?php echo esc_attr($share_url); ?>">
<div class="fi-categories">
<?php foreach ($cats as $slug => $label) :
$url = add_query_arg(
['fi_cat' => $slug],
$base_url
);
?>
<a class="fi-category <?php
echo $active === $slug && $search === ''
? 'is-active' : '';
?>"
href="<?php echo esc_url($url); ?>">
<?php echo esc_html($label); ?>
</a>
<?php endforeach; ?>
</div>
<form class="fi-search" method="get"
action="<?php echo esc_url($base_url); ?>">
<input type="hidden" name="fi_cat"
value="<?php echo esc_attr($active); ?>">
<input type="search"
name="fi_search"
value="<?php echo esc_attr($search); ?>"
placeholder="Search EA or indicator..."
aria-label="Search all EA and indicator products">
<button type="submit">Search</button>
<?php if ($search !== '') : ?>
<a class="fi-clear"
href="<?php echo esc_url(
add_query_arg('fi_cat', $active, $base_url)
); ?>">Clear</a>
<?php endif; ?>
</form>
<div class="fi-share-row">
<button type="button" class="fi-share">
↗ Share Gallery
</button>
<button type="button" class="fi-copy">
Copy Link
</button>
<span class="fi-share-status"
aria-live="polite"></span>
</div>
<div class="fi-grid">
<?php if ($products->have_posts()) : ?>
<?php while ($products->have_posts()) :
$products->the_post(); ?>
<a class="fi-product"
href="<?php the_permalink(); ?>">
<div class="fi-product-image">
<?php if (has_post_thumbnail()) : ?>
<?php the_post_thumbnail(
'medium',
[
'loading' => 'lazy',
'alt' => esc_attr(
get_the_title()
),
]
); ?>
<?php else : ?>
<span class="fi-no-image">
Image unavailable
</span>
<?php endif; ?>
</div>
<div class="fi-product-title">
<?php the_title(); ?>
</div>
</a>
<?php endwhile; ?>
<?php else : ?>
<p class="fi-empty">
No products found. Try another search.
</p>
<?php endif; ?>
</div>
<?php
$total_pages = (int) $products->max_num_pages;
if ($total_pages > 1) :
$pagination_args = [
'fi_cat' => $active,
];
if ($search !== '') {
$pagination_args['fi_search'] = $search;
}
$pagination_base = add_query_arg(
array_merge($pagination_args, ['fi_page' => 999999]),
$base_url
);
$links = paginate_links([
'base' => str_replace(
'999999',
'%#%',
esc_url($pagination_base)
),
'format' => '',
'current' => $page,
'total' => $total_pages,
'mid_size' => 2,
'end_size' => 1,
'prev_text' => '‹',
'next_text' => '›',
'type' => 'list',
]);
if ($links) {
echo '<nav class="fi-pagination" aria-label="Product pages">';
echo wp_kses_post($links);
echo '</nav>';
}
endif;
wp_reset_postdata();
?>
</div>
<style>
.fi-gallery {
width: 100%;
margin: 20px auto;
color: #202833;
}
.fi-categories {
display: flex;
flex-wrap: nowrap;
gap: 6px;
overflow-x: auto;
padding: 3px 0 10px;
scrollbar-width: thin;
}
.fi-category {
flex: 1 0 0;
min-width: 0;
min-height: 58px;
padding: 8px 5px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
background: #202833;
color: #fff !important;
border-radius: 6px;
text-decoration: none !important;
font-size: 12px;
font-weight: 700;
line-height: 1.35;
overflow-wrap: anywhere;
transition: background .2s;
}
.fi-category:hover,
.fi-category.is-active {
background: #1677ff;
color: #fff !important;
}
.fi-search {
display: flex;
gap: 8px;
margin: 12px 0;
align-items: stretch;
}
.fi-search input[type="search"] {
flex: 1;
min-width: 0;
padding: 12px;
border: 1px solid #d4d9e0;
border-radius: 6px;
font-size: 14px;
}
.fi-search button,
.fi-share,
.fi-copy {
border: 0;
border-radius: 6px;
padding: 11px 14px;
background: #1677ff;
color: #fff;
font-weight: 700;
cursor: pointer;
}
.fi-clear {
align-self: center;
font-size: 13px;
}
.fi-share-row {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin: 10px 0 18px;
}
.fi-copy {
background: #202833;
}
.fi-share-status {
font-size: 12px;
}
.fi-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.fi-product {
display: block;
min-width: 0;
color: inherit !important;
text-decoration: none !important;
border: 1px solid #e1e5ea;
border-radius: 8px;
padding: 9px;
overflow: hidden;
}
.fi-product-image {
width: 100%;
aspect-ratio: 1 / 1;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
background: #f3f5f7;
border-radius: 5px;
}
.fi-product-image img {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
.fi-no-image {
font-size: 12px;
color: #777;
}
.fi-product-title {
margin-top: 10px;
font-size: 14px;
line-height: 1.5;
font-weight: 700;
overflow-wrap: anywhere;
}
.fi-empty {
grid-column: 1 / -1;
}
.fi-pagination {
margin: 25px 0;
overflow-x: auto;
}
.fi-pagination ul {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 6px;
list-style: none;
margin: 0;
padding: 0;
}
.fi-pagination li a,
.fi-pagination li span {
display: block;
min-width: 38px;
padding: 9px 10px;
text-align: center;
border: 1px solid #d8dee7;
border-radius: 5px;
text-decoration: none;
}
.fi-pagination .current {
background: #1677ff;
color: #fff;
border-color: #1677ff;
}
.fi-pagination .dots {
border: 0;
}
@media (max-width: 480px) {
.fi-category {
flex: 0 0 145px;
min-height: 54px;
}
.fi-grid {
gap: 10px;
}
.fi-product {
padding: 6px;
}
.fi-product-title {
font-size: 12px;
}
.fi-search button {
padding: 10px;
}
}
</style>
<script>
(function () {
document.querySelectorAll('.fi-gallery').forEach(function (gallery) {
if (gallery.dataset.shareReady) return;
gallery.dataset.shareReady = '1';
const shareUrl = gallery.dataset.shareUrl;
const shareButton = gallery.querySelector('.fi-share');
const copyButton = gallery.querySelector('.fi-copy');
const status = gallery.querySelector('.fi-share-status');
async function copyLink() {
try {
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(shareUrl);
} else {
const field = document.createElement('textarea');
field.value = shareUrl;
field.style.position = 'fixed';
field.style.opacity = '0';
document.body.appendChild(field);
field.select();
const copied = document.execCommand('copy');
field.remove();
if (!copied) throw new Error('Copy failed');
}
status.textContent = 'Gallery link copied!';
} catch (error) {
window.prompt('Copy gallery link:', shareUrl);
}
}
copyButton.addEventListener('click', copyLink);
shareButton.addEventListener('click', async function () {
if (navigator.share) {
try {
await navigator.share({
title: 'Forex In World EA Gallery',
text: 'Explore our Expert Advisors and Indicators.',
url: shareUrl
});
} catch (error) {
if (error.name !== 'AbortError') {
await copyLink();
}
}
} else {
await copyLink();
}
});
});
})();
</script>
<?php
return ob_get_clean();
});
We are available on the following Websites.
EXCLUSIVE OFFER
MT4 & MT5 EA and Indicators (Free Versions, not Premium).
The download link will be sent to your email.
EMAIL SUBMITTED SUCCESSFULLY
Redirecting you to WhatsApp channel in
seconds...

ENGLISH
GERMAN (Deutsch)
FRENCH (Français)
SPANISH (Español)
ARABIC (العربية)
JAPANESE (日本語)
CHINESE (䏿–‡)