• Resolved erwant

    (@erwant)


    Hello,

    I am using PHP snippets to display php code in my wordpress. But when I use the php code the image does not display like when I use the shortcode directly in a page.
    Could you help me to understand please ?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author PickPlugins

    (@pickplugins)

    Thanks for your post,

    I am not sure about your code, without checking the code i am unable to explain is it possible to work with our plugin.

    Regards

    Thread Starter erwant

    (@erwant)

    Hi

    my code is :

    use Carbon\Carbon;
    $year = date(“Y”,strtotime(get_userdata(get_current_user_id( ))->user_registered));
    $month = date(“m”,strtotime(get_userdata(get_current_user_id( ))->user_registered));
    $day = date(“d”,strtotime(get_userdata(get_current_user_id( ))->user_registered));
    $date1 = strtotime(get_userdata(get_current_user_id( ))->user_registered);

    $user_id = get_current_user_id();
    $user_info = get_userdata( $user_id );
    $user_roles = implode(‘, ‘, $user_info->roles);

    $subs_date_W = Carbon::createFromTimestamp($date1)->startOfDay()->format(‘W’);
    $subs_date_YW = Carbon::createFromTimestamp($date1)->startOfDay()->format(‘YW’);
    $actual_date_W = Carbon::now()->format(‘W’);
    $actual_date_YW = Carbon::now()->format(‘YW’);

    $W_of_subs = $actual_date_YW – $subs_date_YW;
    if ($user_roles == “administrator”) {
    $subs_val = 53;
    $W_of_subs = 53;
    } elseif ($user_roles == “s2member_level2”) {
    $subs_val = 4;
    } elseif ($user_roles == “s2member_level3”) {
    $subs_val = 12;
    } elseif ($user_roles == “s2member_level4″) {
    $subs_val = 36;
    }

    $post_grid_equiv = $subs_date_W + 888;

    for ($i = 0; $i <= $W_of_subs && $i <= $subs_val ; $i++) {
    $post_grid_equiv1 = $post_grid_equiv + $i.”\n” ;
    echo do_shortcode(“[post_grid id=’$post_grid_equiv1′]”);
    }

    the result is that :

    View post on imgur.com

    with the shortcode in a page it gives me that (with flip layout) :

    View post on imgur.com

    Thread Starter erwant

    (@erwant)

    Hi I found how to do, I think it was an error from my part. Now it works !
    thank you

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘php code not displaying well’ is closed to new replies.