Parts>Header ad – where's the new place to put my php code?

Posted in: Newspaper
Post count: 18

Good day,

Previously, I was told to use the header ads to put my php code in the header ad space. I see that’s gone now with 9.7, is there somewhere new I can place my php code?

Post count: 35449

Hi,

Now you can set the code directly in ad box using the header manager and set in header an ad box -> https://www.screencast.com/t/4Bej3HcGfH

Thank you!

Post count: 18

It’s not reading the PHP correctly, I’m getting artifacts.

The code is <?php if (twitch_is_live('moarcookies')) { ?>
<div align="center" style="background-color:#c1711b; color:#fff; padding-left:10px; padding-right:10px;">See when we’re live! Join in the conversation and click on the Twitch icon in the lower right of the stream!</div><br /><div id="twitch-embed"></div>

<script src="https://embed.twitch.tv/embed/v1.js"></script>

<script type="text/javascript">
new Twitch.Embed("twitch-embed", {
width: "100%",
height: 480,
channel: "moarcookies",
allowfullscreen: true,
});
</script>
<?php } else { ?>
<?php } ?>

This, before the 9.7 update, worked fine and hid the content if I wasn’t live. Now it just shows up regardless.

  • This reply was modified 7 years by Tutsumi.
  • This reply was modified 7 years by Tutsumi.
Post count: 35449

Hi,

You can still set the code in header ad -> https://www.screencast.com/t/kaGjoE3xj this will be the result -> https://www.screencast.com/t/K3cZ33YJ0cE0
If is not what you mean, please provide some more details, also some screenshots would be very helpful.

Thank you!

Post count: 18

Hi Calin,

While it shows up, part of the PHP code is using a plugin that’s called Twitch Conditional. That plugin hides that video from showing up if we’re not live. If we are, then it shows up.

So what you showed me in https://www.screencast.com/t/K3cZ33YJ0cE0 should not even show up. Either it’s there when I’m live or not when I’m offline.

This worked fine up until the update.

Post count: 18

I’ve tested this in a widget, and it works as intended. Something in the Header Ad area, both in the backened and using TD editor, is blocking the PHP from connecting properly to the plugin.

Post count: 35449

Hi,

Unfortunately we did not tested Twitch Conditional plugin and therefore, we cannot say for sure if it will work or not as expected with the theme, sorry! Also, we cannot provide support for untested plugins.
This is our list with tested plugins with our theme -> https://www.screencast.com/t/cmPkh9jba4sZ

Thank you!

Post count: 18

Can you guys just allow proper PHP to be run through that part? Or make a widget that allows for it?

Post count: 35449

Hi,

Unfortunately you can not add php code directly in theme, you need to set the php code with some php plugin in widgets ( https://wordpress.org/plugins/safe-php-code-widget/ ) and set this widgets in homepage tagDiv Composer -> https://www.screencast.com/t/SMwge3nN2HwW -> https://www.screencast.com/t/oE5S8fy4b

Thank you!

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.