Thomas Krakow
Thomas Krakow

Reputation: 145

New Wordpress shortcode implementation not recognized?

I'm currently developing a shortcode for Wordpress. The shortcode is inside my function.php of the child theme. If I update the function.php because I modified the code it seems that my website is taking the old shortcode implementation.

Could it be that the server is caching the old php code or did I miss something? How can I tell Wordpress to take the new code?

function runningtomy_unitegalery_compact_shortcode($args){
    
    $galleryAlias = UniteFunctionsUG::getVal($args,0);
    $galleryAliasSmall = UniteFunctionsUG::getVal($args,1);
    $catID = UniteFunctionsUG::getVal($args,"catid");
    
    $content = '<div id=\'running-tomy-unite-galery-compact\' class=\'running-tomy-unite-galery-compact\'>';
    $content = $content . HelperUG::outputGallery($galleryAlias, $catID);
    $content = $content . '</div>'; 
    
    $content = '<div id=\'running-tomy-unite-galery-compact-small\' class=\'running-tomy-unite-galery-compact-small\'>';   
    $content = $content . HelperUG::outputGallery($galleryAliasSmall, $catID);
    $content = $content . '</div>';
    
    $content = $content . '\'<style id=\'running-tomy-unite-gallery-css-inline-css\' type=\'text/css\'>
        
    /* running-tomy additional styles */
    @media only screen and (max-width: 590px) {
        .running-tomy-unite-galery-compact-small{
            padding-top: 73.3% !important;
        }
    }
        
    @media only screen and (min-width: 591px) {
        .running-tomy-unite-galery-compact{
            padding-top: 48.97% !important;
        }
    }
        
    </style>';
    
    return($content);
}
add_shortcode( 'runningtomy_unitegalery_compact', 'runningtomy_unitegalery_compact_shortcode' );

Upvotes: 1

Views: 72

Answers (1)

Thomas Krakow
Thomas Krakow

Reputation: 145

I found a solution for this problem. The function

 opcache_reset ( ) : bool

called in a separate php file solved my problem.

https://www.php.net/manual/de/function.opcache-reset.php

Upvotes: 1

Related Questions