-
AuthorPosts
-
November 23, 2017 at 1:18 am #880553
Hi there,
I have inherited an old site running Empire (Woothemes) which I’m moving to Enfold. The old site uses a custom template or two in order to search & output results from a custom table in the MySQL db. The connection info etc is in that theme’s functions.php.
I have a search page, a results page & a catalogue page.
My question is, should I add the custom code from these templates into a code block in Enfold, or should I create custom template files holding that code in my Enfold child theme? Like what has been done on the old site.
The custom code is php & js.
Which approach would you recommend?
If the later, what file (default template) should I base my templates on?
Does this make sense?
I’m afraid I can’t really show you what I mean, actually I can provide a link to the old site if that’s any help? And FTP connection details etc.
I know this might be asking a little too much, but if you could point me in the right direction, I’d really, really appreciate it.
JasonNovember 23, 2017 at 2:05 am #880567Ok, I’ve done a little further research – am I correct in thinking that php isn’t supported via your code block? It’d be a lot easier (for me) if it did…
Anyway, if so, I have already tried copying page.php & /includes/loop-page.php from the main Enfold theme folder into my child theme folder, renamed page.php to template-search.php & loop-page.php to loop-template-search.php but I don’t seem to be able to select this template in the WP editor.
I know I can’t use your template builder with a custom template (that’s fine) but despite having added:/* Template Name: Search */
to the top of my template-search.php file (directly under the opening php tag) it’s not showing up under page attributes.
What am I missing?
November 23, 2017 at 10:07 pm #880950Ok, so WP 4.9 decided to cache template files & not provide a way to clear that cache, which is why I wasn’t seeing them in the drop-down.
Further infoI’d still like feedback / advice on the code block vs custom template files though if possible :)
November 26, 2017 at 10:32 pm #882039Hi,
You can easily create shortcodes with the code and then use it inside Enfold.
It is a better way, rather than copy paste php around.Let us know if you do have any question.
Thank you
Best regards,
BasilisNovember 28, 2017 at 12:42 am #882433Thanks Basilis,
Just so I’m clear, PHP is or isn’t supported (directly) in Code Blocks in Enfold?
I have to create a shortcode from the custom code (which is a combination of PHP & JS) & use that in the Code Blocks (rather than using custom page templates).
Can you give me any guidance, advice or recommendations on the easiest way to create shortcodes usable in Enfold?
Thanks,
JasonDecember 1, 2017 at 12:13 am #883646Hi,
Following the WordPress Shortcode API works just fine
https://codex.wordpress.org/Shortcode_APIand also there is a way
https://generatewp.com/shortcodes/but not used it before
Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.