1

I have created a shortcode using the while loop, which is going to break the loop when used with the page builder. How to solve it. Here may custom shortcode enter image description here here my showing part enter image description here

0

You don't use global $wp_query object anywhere in your code, so there is no point in calling wp_reset_query().

On the other hand, you do use global $post variable, so after your code you should restore it's original value with wp_reset_postdata();.

So change wp_reset_query() to wp_reset_postdata() and it should be OK.

And one more thing...

Shortcodes should return their values and they should not display anything.

So you can't use the_title() inside of it - this template tags echoes its value and doesn't return anything.

You should change it to get_the_title().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.