• i am trying to implement a simple user session trick with insert php but it doesn’t seem to output html code

    tried this in a wp text block element

    
    [insert_php]
    if ( is_user_logged_in() ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    }
    
    [/insert_php]
    

    the above code works well

    but whenever i try to do something like this

    
    [insert_php]
    if ( is_user_logged_in() ) {
        echo '<h4> welcome</h4>';
    } else {
        echo '<a href=""> login </a>';
    }
    
    [/insert_php]
    

    please kindly review the code and please tell me if i miss something, it’s actually my first time with wordpress and plugins generally

Viewing 1 replies (of 1 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    Sambayour, you didn’t tell me what happens when you try the second version. But if you’re getting the angle brackets printed on the page, then try using the “Text” tab instead of the “Visual” tab when you update the post or page.

    Also, some people have experienced issues when both the Visual Composer and Insert PHP plugins were installed. Seems Visual Composer does unexpected things with the code between the insert_php tags. Perhaps that is a clue to what happens when you try the second version.

    Will

    • This reply was modified 6 years, 2 months ago by WillBontrager.
Viewing 1 replies (of 1 total)
  • The topic ‘insert php visual composer integration?’ is closed to new replies.