How to get do_shortcode() to stop stripping contents of a shortcode? - wordpress

I have wp job manager installed and i have echo do_shortcode( '[jobs]' ); in side a custom template but for some unknown reason the shortcode won't output the required results of the [jobs] shortcode.
But when i use the shortcode in the wp editor it works fine, i have been at this for hours and cant seem to find a solution tot his problem any where.
If you have encountered this issue before please advise me how you fixed it.
Thanks in advance

In my case i had a javacript error in the browser console that's why do_shortcode() was not working correctly. I hope this helps someone else

Related

Elementor says - "Sorry, the content area was not found in your page. " while using custom shortcode

I am using default theme of Elementor Plugin. Plugin is very nice but I am facing issue while using my custom shortcode in page. It shows “Sorry, the content area was not found in your page. You must call
the_content function in the current template, in order for Elementor to work on this page.”
[1]: https://i.stack.imgur.com/7xBHV.png
To solve this error, I have added <?php the_content(); ?> in my custom shortcode but it shows the same error.
I have also tried by creating a custom template, but the result is same.
So please help me to solve this error. Any suggestions are acceptable.
Thanks in Advance
Probably your shortcode function changes the post query.
try adding wp_reset_query(); before the function closes.

content area not found in my page with elementor

I just started with Wordpress and I published a website a few weeks ago. Today I wanted to edit the homepage, but I get the following error:
Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page.
I haven't edited my homepage and it worked perfectly a couple of weeks ago. Is there someone that can help me fix this issue?
If you are using any shortcode on your page and you are fetching post on that page and looping through the post in a while loop. Please add this after the loop ends. No sure why but this always cause issue for me.
wp_reset_postdata();
Code will look like this:
$posts= new WP_Query($args);
while ($posts->have_posts() ) : $posts->the_post();
.....
.....
.....
endwhile;
wp_reset_postdata();
It doesn't matter it's a shortcode or what if we are doing something like above make sure to add wp_reset_postdata();
This is one of the issues that I usually face. There can be other reasons too.
Probably you've edited the page template from Templates -> Theme Builder -> Single. Anyway, even if you don't, you can fix it that way: Go to Templates -> Theme Builder -> Single -> Add New, then select page and create a template for all single pages (make sure that you drag the page content widget in the template). This should overwrite your theme single page template (which misses the content function).
Just make sure your 'Home Page' and 'Posts Page' are different, otherwise you get your page mixed up and this error occurs.. Worked for me!
You can verify this setting in Appearance>Customize>Homepage Settings :)
The Answer to this error is to check the structure of your permalinks. Try to save your permalinks one more time. Also, try to change the permalink structure to “Plain”. Some servers do not allow to write to the .htaccess file and as a matter of fact, you cannot always modify your permalink structure and edit with Elementor.
I found myself in the same place yesterday and freaked for a moment and did some research to find out why I was receiving the error and came across this page. Believe for me it occurred due to the situation Ed Jones posted about above, I had inadvertently edited the post template. But a fast and easy fix was to go back to an earlier revision of the page in my history. That solved my problem quickly.
Add the_content() at the end of your templates

do shortcode not working for Advanced post slider

I've been stuck on this for a while. I'm working on a wordpress site.
I'm trying to use a Advanced post slider plugin, but calling it in a template via
echo do_shortcode('[advps-slideshow optset="1"]'); //just isn't working.
But it is working when directly pasted [advps-slideshow optset="1"] in wordpress page.
Any help would be greatly appreciated.
Advanced post slider looks to be working my end with the code you provided. What happens if you do <?php print_r(do_shortcode('[advps-slideshow optset="1"]')); ?> are you also getting any js errors in your console log?
the problem seems to be in the plugin itself, as I see no errors in the string you wrote. I think you should write the developers with this issue. you may suggest you another slider plugin with shortcodes for WP post galleries- freemake slider. on you blog it works well. the archive can be loaded from here http://www.freemake.com/free_wordpress_slider_plugin/

Wordpress wp_get_archives function not working

I am trying to use Wordpress function:
<?php wp_get_archives(); ?>
But it gives no results. It worked yesterday, but I probably accidentally did something and now It's not working anymore. No, Im not deleted all the posts, I'm not deleted archive.php page. What could I do? Maybe there is some "archive - turn off" option in admin panel?
Try some parameters and see if you can get them to work: http://codex.wordpress.org/Function_Reference/wp_get_archives

Shortcode is not working in wordpress 3.0

Is there anything need to enable for shortcode to work in Wordpress 3.0? I have tried some short codes and none of them working as expected.
regards - dj
If its a template file you are trying to put them into you will need to put the code into a function and display it like:
<?php echo do_shortcode( '[contact-form-7 id="448" title="Contact"]' ); ?>
I am guessing you have it all sorted by now though as I have just checked when this was posted.
Short codes are as simple or as complex as you intend them to be. Also they can solve some pretty annoying problems and add a lot of functionality for your users. One thing I always use a short code for is embedding YouTube videos and media of the same format.
Here are some links that may help you:
Google Maps Short Code - by Chris Coyier # http://www.digwp.com/
Short Code API - WordPress Codex page about
short codes
Plus make sure you call the following function
the_content()
to output your content

Resources