Support » Fixing WordPress » Weird WordPress style with do_shortcode and style sheet

  • I have very weird problem with do_shortcode and style sheet (CSS)

    [ redundant link removed ] Above page has 2 exactly same shortcode which is below

    [ld_course_list course_category_name=”english” col=4 progress_bar=true]

    In the page, top one is straight shortcode above.
    below one is exact shortcode with PHP snippet with if statement which is below
    I am forced to use PHP code because I want to display different shortcode depending on a condition in if statement.

    <?php
    $curr_user_id = get_current_user_id();
    // the value is 0 if the user isn't logged-in
    if ( $curr_user_id != 0 ) {
        // we know now the user is logged-in, so we can use his/her ID to get the user meta
        $um_value = get_user_meta( $curr_user_id, 'user_phone', true );
        // now we check if the value is correct
        if ( ! empty( $um_value ) && $um_value == 'French' ) {
            echo do_shortcode('[ld_course_list course_category_name=french col=4 progress_bar=true]');
        } else {
            echo do_shortcode('[ld_course_list course_category_name="english" col="4" progress_bar="true"]');
    }
    }
    ?>

    Not sure why they are showing up difference with missing elements. Any help would be appreciated.

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • @joongpark,

    Try replace this line:

    if ( ! empty( $um_value ) && $um_value == 'French' ) {

    with:

    if ( (! empty( $um_value ) ) && ($um_value == 'French' ) ) {

    Wrap the individual args with () in an if with their own (). Each arg must eval to true using && to continue complete arg as true.

    Thank you. I tried that and it looks the same.
    I just cannot figure out why exact same shortcode looks different just because of do_shortcode.

    I don’t think it’s caused by coding of php…calling shortcode using do_shortcode is doing something funny but I have no idea.

    🙁

    Where is this code in your site?

    You should not share your credentials in a public forum. These may be used by someone with malicious intent to harm your site.

    Tagging for mods to remove the credentials.

    Also, where have you put the PHP code?

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    joongpark, Under no circumstances should you ever post any login credentials to your site. Please do not do that again, that goes way too far.

    If anyone took you up on that offer then they would risk getting banned from this site.

    There are many ways to get information you need to people and offering any access to your site not one of them. That’s going too far.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing a system that way is a short cut that will get you into real trouble in these forums.

    Oops..it was temp credentials that I was going to delete.

    Anyway..this is how code is inserted to the page. I am using plugin. I tried other plug-ins and results are the same.

    https://imgur.com/a/8ORAvXy

    Here is what the results is.

    https://imgur.com/a/LBUYXtu

    You can see they come out looking very different even though they are both same shortcode.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Oops..it was temp credentials that I was going to delete.

    It doesn’t matter. Please do not repeat that again.

    Interesting
    Can you try changing the order of the PHP snippet and the “normal” shortcode?
    Let’s see what happens in that case.

    I just tried it.
    It’s does not help…bottom on without the border appears at top.

    I tried to look at the page source and there is no problem with stylesheet..both above and bottom code looks the same so it should look the same.

    Very very weird.

    Moderator…please delete this posting. Thanks

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Weird WordPress style with do_shortcode and style sheet’ is closed to new replies.