[Resolved] Unable to show ditty news ticker via PHP direct function
Hi, I am using the Montezuma theme and have created a ditty news ticker correctly. If I embed the shortcode on a page, in a widget it displays very well.
If I take the php syntax and embed it in a php template it will not display.
shortcode: [ditty_news_ticker id=”356″]
php direct function: <?php ditty_news_ticker(356); ?>
Can you provide a link to a page on your site that uses the direct php function?
Hi, sorry I’ve had to set the site up live.
If you to http://www.8thpillar.com/
I have included a direct call in the header, main page area and footer
Thanks. There wasn’t anything I was able to tell by viewing the source or console. Could you email me your .php files (header, main, footer) where you have included it?
user: I don’t know if this will be of use as the php code is actually in virtual templates that I access via WordPress admin
I’ve copied and pasted the 3 page.php, header.php and footed.php into the attached file, but I’m guessing you may need more than this?
Please let me know and I’ll try search for the physical php file(s) on disk that contains these virtual templates.
me:By virtual template do you mean you’re editing by using Appearance > Editor and modifying the theme there?
I testing that out and it seemed to work fine for me when editing through the dashboard.
Are you sure you editing the correct theme? If you are using a child theme or something the file you are editing me be overridden by another file.
Hi, thanks for checking.
I am using Montezuma theme and I have edited the “Main” and “Sub Templates” within “Montezuma Options”. Specifically the page.php Main Template and the header.php and footer.php Sub Templates.
I’ve added the direct function three times just to get enough coverage to try figure out why it doesn’t show the ticker.
Is this sufficient information or do you need something further? So in summary, if you have a vanilla install of WP I would think if you install the ticker plugin only and then add the direct function into one or more of header.php, footer.php and page.php, that should be enough to prove if it’s working and I have something else causing some contention?
Thanks very much,
I know the direct function works. It’s what I use in the header here: http://dittynewsticker.com/. I’ve also used it many times on other projects I’ve done.
It seems like it’s an issue with your theme. I have never used the Montezuma theme, but, it sounds like the theme uses it’s own implementation of a theme editor that may strip out php or something…
What happens is you just insert the following:
<?php echo 'This is a test to see if any custom php works; ?>
You will probably have to contact the author of the theme to resolve this issue. There isn’t anything “special” about the direct function used to call Ditty Ticker. It’s just a basic php function that displays the ticker the same way the shortcode displays it. The shortcode actually calls the same function.
I tried the following in the footer (tried with and without echo):
<?php ditty_news_ticker(357); ?>
and got the following output:
So I’m a bit baffled too. I’ll keep thinking and post back if I have any better ideas.
If you did not include ‘echo ‘ before the ‘before’ and ‘after’ you shouldn’t have seen any output as the php would not have printed anything to the screen. Which means, that however your theme renders the edited files, it strips out the php tags and is just displaying what you put in as HTML, which is why my function isn’t being called.
You will either need to modify the theme via the Appearance > Editor screen in your dashboard or contact the theme author and see if they have any advice on including php with their custom editor.
It is possible, depending on what the theme does to render the file, that you can just put the shortcode in your edited file… and it may work. So, try just inserting the actual shortcode and see what happens.
Hi, The shortcode just outputs the [ditty_news_ticker id=”357″] as text on the page
That’s a good point about the echo and proves your point, so I’ll dig further using the main Editor and see if that helps, rather than using these Templates which must do some additional rendering.
Thanks for assisting
- The topic ‘[Resolved] Unable to show ditty news ticker via PHP direct function’ is closed to new replies.