Support » Developing with WordPress » Conflict between my JQuery and PHP scripts

  • Resolved chdemers


    It seems that my PHP script interferes with my slidetoggle function, and I don’t know why.

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ack, you forgot to use the code button. Paste your code again, select all, and click the button above.

    [easyembed field=”testpat”] //calls custom field, which is this slide toggle function
    <div id=”monBloc”>Lorem Ipsum</div>
    Contenu masqué
    <?php global $post;
    $args = array( ‘numberposts’ => 4, ‘offset’=> 0, ‘category’ => 140 );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) : setup_postdata($post); ?>
    ” target=’_blank’ ><?php the_excerpt(); ?><?php endforeach; ?>

    What do you mean by “PHP script interferes with my slidetoggle function”?
    What exactly happens and what is expected, maybe you can post link to your site?
    JavaScript can’t interfere with PHP in any way. If you have JavaScript error, that’s probably conflict between two JavaScript scripts. If you have wrong HTML generated by PHP – problem is in PHP and there is nothing to do with JavaScript.
    You probably should post that part of JavaScript where you call slideToggle and part of PHP code that generates HTML of that section that needs to be toggled.

    Hi chdemers,
    As Oleg pointed out, you’ll need to provide more detail. However, the jQuery ‘$’ does present some issues on some sites. This can be resolved by replacing all instances of $ by jQuery

    with :

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conflict between my JQuery and PHP scripts’ is closed to new replies.