Archived topic
Ticker location PHP / Short code
8 replies · Started by tenchystryder on March 20, 2019
Hi Guys
I am using the Ditty News Ticker for my site. I am looking at placing it in the top bar.
Is there a reliable way of adding either PHP or Shortcoding.
I have tried adding custom HTML widget but it will not show the ticker. At the moment I have it showing it the top content area of the home page only.
Here is the PHP that the Ditty plugin is giving me
<?php if(function_exists('ditty_news_ticker')){ditty_news_ticker(2563);} ?>
BTW - I have my addtoany social icons in top bar. I am not worried if I have to remove them for the styling. Also, not sure if the top bar GB color if affecting it. I have changed it to #ffffff but it still did not show the ticker
Hi there,
does the plugin provide a shortcode? if so that should work within a HTML widget.
If not then you can use a Hook to add the php, but it would have to be above the top bar by using the before_header hook:
https://docs.generatepress.com/article/hooks-element-overview/
Hi David
Yes that worked thank you. Both with shortcode and PhP. I have used the PhP code in my first post.
I have set site wide and all users in the hook as the login is disabled anyway (read only site no comments).
Is there a way I can centre it, add padding, change colours etc ?
By the way, above header puts it between header and top bar, not over the top bar
Sorry, last post should read "before header"
So in the hook element --> priority field set this to a lower number, i think 5 should do it, worst case change it to zero and it should appear above the topbar.
Styling it with some CSS:
.mtphr-dnt-tick-container {
text-align: center;
padding: 10px 0;
background-color:#ffffff;
}
Super dooper. That worked great thank you David.
Decided to leave it where it is. Stands out a little better.
I can mess about with it now :-)
Great work as always thanks
You're welcome