e107help.org Q&A
0 like 0 dislike

Where can custom theme news_template shortcodes be defined?

 

For instance, i've got on my theme a custom news_template.php file, in wich i have a custom shortcode need.

Where can i define this custom shortcode so i can use it on my custom theme news_template?

  • In theme_shortcodes.php?
  • In news_shortcodes.php in the same folder as news_template.php?
  • Or somewhere else?
e107 version 2.1
closed with the note: Found out the solution miself....
in Plugins by (310 points) 25 40 48
closed by

2 Answers

0 like 0 dislike
Good question, I would make it as a plugin. To do that I would go and make a folder in e107_plugins called news_templates (or a better name if you have it) then make the e_shortcode.php.

 

Then go into Admin Area -> Database -> Scan plugin directories... Check to see if the plugin is listed with the e_shortcode (if you see it listed but have a red x then your shortcode is screwed up)..

 

After that go into your news_template.php and add the shortcode {NEWS_TEMPLATE_RICA} or what ever name you have it named..
by (459 points) 17 37 50

I am sorry to hear had that experience. If I remember correctly, there was just one other person involved and I strongly feel that in this case language barriers in combination with 'typed' text instead of actually 'spoken' text were the cause of this issue.

Please do feel free to post it up there again as you will not get the answer you are looking for here. On Github is where development takes place. I'll make sure to monitor to ensure a more peaceful experience this time. 

 

My post was a sujjestion on how to do it, I will ask on github - think theme should also have a e_shortcode.php or something, idk. You sure you can't do it in theme_shortcodes.php?

@Moc: Thanks for your support, and if remember correctly, i was advertised on that issue to present my issues here, instead of on github, since i "should do distinction between real e107's issues which are posted here and your"(my)" learning problems. Please use e107Help for that."....

Anyway, if LaocheXe doesn't bring that issue up on github, i'll do it so...

@LaocheXe: Since on that same github issue i was "teached" to replicate theme issues inside the Bootstrap 3 core theme, i'll do that also, and see if indeed the theme_shortcodes.php is used on custom plugins templates inside the theme or not.

I'll keep you posted...

Anyway, if that doesn't work, i've got another ideia, maybe easier:

- Why not use a define("CUSTOM_SHORTCODES") or else (just like the BOOTSTRAP or FONTAWESOME define....), in the plugin template inside the theme, and with that, instruct e107 to render the theme overrided shortcodes instead of the plugin ones? For instance, if that define is present, the shortcodes search & render order should be core -> plugin -> theme. If it's not present, it should be core -> plugin....

Just another ideia....

On core bootstrap3 theme, there's also a no go, if i define the shortcode inside the theme_shortcodes.....

For now, the only solution i find out to do it inside a theme, without using a specific plugin, is what i've posted on github.....
0 like 0 dislike
https://github.com/e107inc/e107/issues/1467

To be able use custom shortcode in news template is now possible only one way (override system doesn't work too - from MIRO video)

- create custom plugin and define your shortcode as global in e_shortcode.php.

Global shortcodes can be used in any template and theme shortcodes can replace them.  But BATCH shortcodes (or any shortcodes that are not global -  doesn't defined in file begins e_) is not possible to override by theme shortcodes.
by (2.0k points) 18 48 58
996 questions
1,389 answers
2,527 comments
2,512 users