jeudi 17 mars 2016

shortcode not working after migration

I wrote my own plugin to display some information in a dynamic way. Everything worked perfectly on my localhost but when i did the migration to the server the shortcode of my plugin(and only that one) is displayed as text.

I checked and the plugin is still activated.

this is my plugin:

<?php
/*
Plugin Name: video-linker
Plugin URI: http://example.com
Description: Youku, Youtube and Vimeo linker
Version: 1.0
Author: Arno Turelinckx
Author URI: http://example.com
*/

$youku = '';
$youtube = '';
$vimeo = '';
$image = '';

function visualize_buttons($atts) {

    //get the links from the shortcode
    $attributes = shortcode_atts( array(
        'youku' => '',
        'youtube' => '',
        'vimeo' => '',
        'image' => '',
    ), $atts );

    $youku = $attributes['youku'];
    $youtube = $attributes['youtube'];
    $vimeo = $attributes['vimeo'];
    $image = $attributes['image'];

    echo '<div style="position: relative;">';
        echo '<div class="video-linker-image" style="background-image: url('.$image.');background-size: cover;"></div>';
        echo '<ul class="video-linker">';
            echo '<h2>Watch the video</h2>';
            echo '<li class="video-linker-youku"><a href="'.$youku.'" target="_blank"></a></li>';
            echo '<li class="video-linker-youtube"><a href="'.$youtube.'" target="_blank"><i class="icon-youtube"></i></a></li>';
            echo '<li class="video-linker-vimeo"><a href="'.$vimeo.'" target="_blank"><i class="icon-vimeo"></i></a></li>';
        echo '</ul>';
    echo '</div>';
}

function cf_shortcode($atts) {
    ob_start();
    visualize_buttons($atts);

    return ob_get_clean();
}

add_shortcode( 'video-linker', 'cf_shortcode' );

?>

And this is the way I call the shortcode in my page:

[video-linker youku=”” youtube=”” vimeo=”” image=”url_to_image.jpg”]

Any idea what the problem could be?

Any help is appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire