djeyewater
Forum Replies Created
-
Forum: Hacks
In reply to: Calling get_the_excerpt from a filter on the_content kills shortcodesThanks for the suggestion, I’ve just tried using
add_action
instead ofadd_filter
, but it gives exactly the same result. It seems that actions on the_content are processed when you call get_the_excerpt as well – your example gave me an infinite loop error.add_action('the_content', 'myTest'); function myTest($content){ //content filters are run on get_the_excerpt, so we must remove our filter before calling it to avoid an infinite loop remove_action('the_content', 'myTest'); $content .= '<div>' . get_the_excerpt() . '</div>'; add_action('the_content', 'myTest'); return $content; }
Yes, I’m trying to append the excerpt to the end of the content (as part of a URL). For the purposes of this example though I omitted the detail, the main point is that calling get_the_excerpt is stopping shortcodes from being processed.
Forum: Hacks
In reply to: Calling get_the_excerpt from a filter on the_content kills shortcodesI’m not trying to do either of those things. I’m trying to
get_the_excerpt
from within a filter onthe_content
.But doing this will make any shortcodes within
the_content
so that they aren’t parsed.Example:
- Create a new post that contains the shortcode
[caption]
. - View the post – it will be empty because the shortcode is parsed correctly.
- Now add the code to your theme’s function.php:
add_filter('the_content', 'myTest'); function myTest($content){ //content filters are run on get_the_excerpt, so we must remove our filter before calling it to avoid an infinite loop remove_filter('the_content', 'myTest'); $summary=get_the_excerpt(); add_filter('the_content', 'myTest'); return $content.'<p>Content edited</p>'; }
- View the post again – you will see the text [caption] as shortcodes are now not being parsed.
Forum: Plugins
In reply to: [W3 Total Cache] Minify is broken in latest version of W3TC 0.9.3For me the latest version of W3TC didn’t work at all. It was listed in the plugins list in the Network admin panel, but didn’t appear in the plugins list for any blogs. (This is with WPMU). For one of the blogs that had previously had W3TC enabled, there was an entry in the menu for W3TC, but the settings page was missing all the settings.
I’ve downgraded to 0.9.2.4, but having minify switched on for css and js makes the site really slow. It’s not regenerating the cached minified files on each page load, so I don’t know what the issue is.
I’m getting the following php notice:
Notice: Undefined variable: onclick in wp-content/plugins/stop-spammer-registrations-plugin/stop-spammer-registrations.php on line 597
this can be fixed by adding
$onclick="";
just before the if statement on line 590.Forum: Plugins
In reply to: [XML Sitemap Generator for Google] PHP Notices in WP 3.5.1.I get a ton of PHP notices from this plugin in the admin area, to do with calling non-static methods statically.
It can be fixed by opening the sitemap.php file and doing a find and replace to replace “function ” with “static function ”
Forum: Themes and Templates
In reply to: [Twenty Twelve] Add a menu in the sidebar in a page templateThanks, I understand that register_nav_menu can be used to create a named location for a nav menu. But that page doesn’t seem to specify how you would make it so that the named location then correlates to a position inside the sidebar.
The bit I was confused with was how to make that named location be inside the sidebar. But after reading the docs for get_sidebar, and seeing that all it was doing was a simple include, I realised that I could just copy across the contents of sidebar,php into my page template and then modify it as necessary. (As per my previous post).
Forum: Themes and Templates
In reply to: [Twenty Twelve] Add a menu in the sidebar in a page templateOkay, but how do I register a new menu location within the sidebar?
Edit: I think I’ve got it now, in my page template I removed
<?php get_sidebar();?>
and replaced it with<div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-1' ); ?> <?php wp_nav_menu(array('theme-location' => 'extra', 'menu' => 'extra-menu')); ?> </div><!-- #secondary -->
I’m guessing that’s the correct way to do it? (Seems to work anyway)
Forum: Plugins
In reply to: [W3 Total Cache] Scheduled post not workingI’ve now tried disabling all other plugins and switching to the twentyten theme, but leaving w3tc activated with no caching enabled. Still cron does not work.
I haven’t tried it on a fresh install of wordpress though. My site is a multisite installation if that makes any difference.
On my live site I’m going to disable wp_cron, then do a real cron. This seems to be recommended over wp’s fake cron anyway. Something like:
0 */6 * * * /usr/bin/curl "https://www.domain.com/wp-cron.php?doing_cron" >> /home/username/cron.log 2>&1
to run it every 6 hoursForum: Fixing WordPress
In reply to: wp-cron not working automatically – how to debug?Thanks again for the advice, I managed to narrow it down to the W3 total cache plugin. I’m still not sure why cron is not working, but getting closer to the problem than I was before.
Forum: Plugins
In reply to: [W3 Total Cache] Scheduled post not workingHaving the same problem. I have deleted W3TC (through the admin panel), removed the settings file (manually), and then reinstalled the plugin (through the admin panel), but cron is still not working.
I disabled all options on W3TC, but still cron does not work. I normally use W3TC with no caching, only minification and combining of css and js, and a generic mirror cdn for static files.
Cron works fine when W3TC is disabled.
Forum: Fixing WordPress
In reply to: wp-cron not working automatically – how to debug?Thanks for the advice, I will give that a go then.
Forum: Fixing WordPress
In reply to: wp-cron not working automatically – how to debug?It’s not super busy, but gets enough traffic (around 350 visits a day) that I don’t want to go down the route of disabling all plugins and switching to the 2010 theme to see if the problem still persists.
I guess I could copy the site and db to my local environment for testing, but would prefer to try easier debugging methods first (if there are any).
Forum: Plugins
In reply to: [WordPress Share Buttons Plugin – AddThis] PHP NoticesFound the problem – when you network activate the plugin, each site will have the following for addthis_settings entry in the options table:
a:2:{s:9:"atversion";s:3:"250";s:8:"wpfooter";b:1;}
With the above, the ‘errors’ I had will show up.
If you go into the plugin settings for each site and just click save, then the addthis_settings entry in the options table will be much larger, and you don’t get the notices any more.
So maybe something about Network activating could be fixed.
Forum: Plugins
In reply to: [WordPress Share Buttons Plugin – AddThis] PHP NoticesHi srijith.v
Since you are unable to reproduce it, I have looked into it a bit, to try and reproduce it myself. I have a wordpress multisite installation, so different sites are running different themes and are using different plugins.
I could not reproduce it on one site, but am now trying another site (using the 2012 theme) and have got the error in my logs. I will try and narrow down the exact combination of theme & plugins, and post back when I have more info. (Might be tomorrow now).
Forum: Plugins
In reply to: [WP YouTube Lyte] Various PHP errorsHi I found another notice listed in my error logs:
[12-Jan-2013 23:58:18] PHP Notice: Undefined variable: pos in /wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 177
To fix line 174 add $pos=null;Thanks for fixing them, I know they don’t affect plugin functionality at all, but I like having max error reporting on to aid me in debugging my own code.
- Create a new post that contains the shortcode