Here is the situation.
I have setup a site using Magento-Wordpress integration. The integration works so I can call in the Magento site whatever I want from wordpress.
I want to show in the product page, a post from wordpress, that contains a specific word.
In my opinion, I have to search in the_content() of the posts the title of the product and then bring the post_meta I need.
The problem is that I cannot get it working.
I tried this:
<?php $name_of_product = $_helper->productAttribute($_product, $_product->getName(), 'name') ?>
<?php echo $name_of_product ; ?>
<?php $args = array( 'post_type' => 'avada_portfolio', 'posts_per_page' => 103 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
<?php
$pos = strpos( get_the_content(), "[Dominos]" );
var_dump($pos);
if ( ! (FALSE == $pos) ) {
the_content();
the_title();
}
else{echo ("NOTHING HERE");}
echo '</div>';
endwhile;
?>
but didn’t work.
Any suggestions?
Based on your
var_dump()
output, you should be able to simply use:First check your
$content
, maybe it empty:if not empty and that is shortcode you can use next code for example: