Custom Content from PHP, Multiple Categories, Tags available
-
Hi,
• I use the lay theme as a child theme for a client and want to remove the radio buttons plugin you add in your functions.php. How would I do it with php in the childs function.php? – Why are you doing this? (because of the project arrows?) Whats the downside of removing the radios and enable checkboxes?
• I want to have custom content generated from php on a particular page, how do I inject the content? Basically i want to loop over a category and display all posts within this category with all the content, not only thumbnails. I wrote a plugin that does the needed and outputs HTML from a shortcode, but when I add a shortcode to a gridder element (+Shortcode) its not in the react-flow, but is appended on every page?
• Doing the above: is it possible to get the gridder content of a particular page and display it as HTML or JSON that will be parsed?
• Why are tags disabled? Is there an easy way do enable the tags again in the functions.php of the child theme?
Let me know if this makes sense.
Thanks in advance,
Fabian -
Dear @h2o
we do not recommend to use LayTheme as a child theme. Nor we recommend to edit the PHP because it might change with an update.We recommend to have a look into LayGridder: http://laygridder.com/
There you can use LayGridder within your own Templates.
Best!
Marius
-
Mh, that's a bummer. Maybe you should communicate that on your website.
There is no way you get this info before you purchase it.I guess it's not an option, because then i will have more work with the coding of the rest of the site. Your template is nice and i chose it because it works out of the box.
As you know, if my child theme has it's own functions.php it will not replace the parents function.php, but execute before. So, it will not break anything if one takes care.
-
remove the radio-options: just make a class Radio_Buttons_for_Taxonomies {} in my childs functions.php, so class_exists fires true and does not continue to register the plugin
-
if i add content through a shortcode in the laygridder, is not added to the ajax flow on the frontend, but added to the websites html after the ajax-container, bug or feature?
— LayShortcodes::get_shortcode_contents(); in index.php -
add tags: why did you remove it? – i really want to know, because i registered it again with a hook to add_action
my functions.php looks like this now:
// initial register radio-buttons class, but empty, to fire class_exists true
class Radio_Buttons_for_Taxonomies {}// re-registers taxonomy after the parents setup due to function priority
function add_post_type_support() {
register_taxonomy_for_object_type('post_tag', 'post');
}
add_action('init', 'add_post_type_support', 20); -
-
hey h2o!
I'm changing lay theme now so it finally supports categories and tags.
ok so most plugins wait for the document ready event to fire their javascript. that's why when a shortcode is added somewhere, when you visit that page, the website is reloaded, the shortcode is parsed in normal php and then that html is copied into where the shortcode is in the gridder. i know that's kind of complicated and it is a workaround, but most wordpress plugins are just not made for pure javascript frontends, like the frontend of laytheme
an alternative for you would be to use the "newpage" event ( http://laytheme.com/documentation.html#custom-javascript ) and then build your markup using javascript and the wordpress rest api ( https://developer.wordpress.org/rest-api/ ) .
If you want to build a child theme, go ahead and do that. But other than changing the header, footer and function files, there's not much to do here. the big reason to do a child theme is to overwrite certain template parts of a theme. Overwriting all these .php files that are part of the template hierarchy for example https://developer.wordpress.org/themes/basics/template-hierarchy/
But laytheme doesn't have these files, only a index.php and the rest of the frontend is just javascript. -
ok, works as expected then. i also had a bug in my plugin, custom shortcodes for custom html content works now and integrates in the flow of the website.
one last question (for now):
how can i reactivate the tinymce link plugin for the editor when i am using advanced custom fields?best and thanks,
fabian -
-
Hey @h2o with the latest update, you can now use multiple categories.
how can i reactivate the tinymce link plugin for the editor when i am using advanced custom fields?
Hm, not sure! Does it hide when you use acf?
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it