- This topic has 11 replies, 4 voices, and was last updated 7 years, 7 months ago by
Tom.
-
AuthorPosts
-
April 6, 2016 at 7:05 am #184672
Nat
Hey Tom,
How are you? I wanted to add a code to the After Content Hook, but I want to show the result ONLY to the blog posts and to the homepage. In other words, the home page will only show the excerpt and not the content I want to add to the After Content hook. Is that possible?
Thanks,
NatApril 6, 2016 at 7:13 am #184674Nat
Sorry Tom. I figured it out. I had to check “Execute Php”
April 6, 2016 at 11:11 am #184742Tom
Lead DeveloperLead DeveloperGlad you got it sorted ๐
April 19, 2016 at 2:31 am #187855Vika
Hi, Tom!) Can you tell, please, is it possible to make new widget zone after posts?
My problem: -my site has 4 languages,
-I need widget zone after posts,
-because I want to put there widget “Text”,
-then put there HTML code of my subscribe form.
The problem is I use Polylang and I need to do 4 different widgets on different languages.You sent me this advise:
There’s no widget under the box, but you could use GP Hooks in the “After Content” hook.
Like this:
<?php if ( is_single() ) : ?>
Your HTML in here
<?php endif; ?>Then check the “Execute PHP” checkbox
But it is usefull in case with one language. Is there any way to deal with my problem? ๐
The illustration there: http://pixs.ru/showimage/widgetpng_7002180_21607769.pngApril 19, 2016 at 5:10 am #187887Roberto Enrique
I think that you can sort that out with:
https://wordpress.org/plugins/widget-shortcode/
and
https://wordpress.org/plugins/widget-logic/
This thread also might help:
https://wordpress.org/support/topic/polylang-different-index-for-english-version?replies=2
April 19, 2016 at 9:12 am #187922Tom
Lead DeveloperLead DeveloperThose links Roberto pointed to should all be very helpful.
Instead of widget logic, I would suggest this one though: https://en-ca.wordpress.org/plugins/display-widgets/
Thanks, Roberto! ๐
April 20, 2016 at 2:21 am #188080Vika
Thank you, but this plugins compatible up to 4.3.3 wordpress version and I have 4.4.2. What to do? ๐
Is it any opportunity to write smth like this:
โAfter Contentโ hook.
<?php if ( is_single() ) : ?> <strong><em>Do Arbitrary widget???</em></strong> <?php endif; ?>
April 20, 2016 at 2:39 am #188091Vika
or I need PHP hook with condition:
<?php if ( is_single on Russian () ) : ?>
my HTML-1
<?php endif; ?><?php if ( is_single on English () ) : ?>
my HTML-2
<?php endif; ?>etc.
How to write it correct?
*sorry for annoying*April 20, 2016 at 2:47 am #188093Vika
I have different adresses for pages on different languages:
/blog/
/blog/ru/
/blog/id/
/blog/ms/maybe it can be used like condition?…
April 20, 2016 at 9:39 am #188149Tom
Lead DeveloperLead DeveloperThat plugin should work fine on the latest version of WP.
If you’re using the Polylang plugin, then you should be able to do this:
<?php if ( is_single() && 'Russian' == pll_current_language('name') ) : ?> We're on a single post and Russian is the language <?php endif; ?>
April 21, 2016 at 1:53 am #188288Vika
Thank you very much guys, Roberto and Tom! It really works!
Instead of only one small point:
this didn’t work:<?php if ( is_single() && 'Russian' == pll_current_language('name') ) : ?>
I used:
<?php if ( is_single() && 'en' == pll_current_language() ) : ?>
hope our solving of this issue will be usefull to somebody else! ๐
-
This reply was modified 7 years, 7 months ago by
Tom.
April 21, 2016 at 9:00 am #188364Tom
Lead DeveloperLead DeveloperThanks! I’m sure it will ๐
-
This reply was modified 7 years, 7 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.