Wordpress wp_get_archives function not working - wordpress

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

Related

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

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

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

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/

Add shortcode inside another with echo

I try to nest a shortcode to another in my page. Why this isnt working?
[toggle]
<?php echo do_shortcode('[Best_Wordpress_Gallery id="1" gal_title="my"]'); ?>
[/toggle]
There's not enough information in your code sample to say for sure. However, it looks like you are attempting to put PHP code into an actual WordPress page/post. Is that the case? If not, please provide more info on what you're trying to do exactly.
If so, you can't put PHP inside post/page content in WordPress without enabling the ability to do so. The easiest way to do this is with a plugin. There are several in the Plugin Directory: https://wordpress.org/plugins/search.php?q=php+code.
Also, see this answer for a similar question: https://stackoverflow.com/a/18896308/3147332

facebook comments with wordpress not working

I've a wordpress blog for my website and added facebook comment for that. It shows the option to enter the comment using facebook account. But that doesn't show the comments from users.
Any idea about that will be really helpful.
try this plugin
facebook-comments-for-wordpress.3.1.3
only you have to write the following shortcode wherever you want comments to be displayed:
<?php if (function_exists('facebook_comments')) facebook_comments(); ?>
I have implemented it and it works fine.

Resources