WatcherJoshua
Forum Replies Created
-
The background image is applied from the Site Editor in the Styles panel > Background section.
Adding the background via a Group Block in each template might fix the problem since nothing from the template shows up by default. But then if (when) we want to change the background I would have to update every template instead of one place.
Forum: Fixing WordPress
In reply to: Can I expand the “Advanced” tab in Gutenberg blocks by default?I have reviewed the plugin you recommended, but I do not see how it can solve my problem. The plugin seems to just add several new Gutenberg blocks that I do not need.
I want to expand the “Advanced” settings box by default on all core Gutenberg blocks. I would prefer to not use a plugin for it. However, if a plugin can do it, that implies that I could do it by adding code to functions.php – which I would prefer.
Forum: Plugins
In reply to: [Details Summary Block] Cannot type a space inside the summary fieldI would also like a proper solution to this, but I have found two workarounds.
1. Use the code editor.
2. Copy/paste the text you want in the summary.
Forum: Developing with WordPress
In reply to: Add custom post types to Dashboard Activity widgetThis is all very helpful. I have a basic working version now. Thank you.
Forum: Developing with WordPress
In reply to: How to PHP include a theme fileThank you. I tried all of the ways that you suggested, and they did not work – but you did help me get pointed in the right direction. I was not certain if concatenation would work at all with an include statement, and you confirmed that it did.
I was also using the wrong function. I was not familiar with
get_template_directory()
.To elaborate on the use case: I need to include the raw SVG code in the document so that it can be styled with CSS (this would also be necessary for accessing it with JS). I could just copy/paste all the SVG into the document, but that clutter the code and make it hard to change it later. Including the separate document means I can change the icon in Illustrator without needing to change the PHP file as well.
With a little more research, I found that this is a known issue with using
include
to insert an SVG with PHP. The easiest work-around is to usefile_get_contents()
instead.The code that worked:
<?php echo file_get_contents(get_template_directory_uri() . '/images/icon.svg'); ?>
I found this information about the PHP and SVG issue at: https://sheelahb.com/blog/how-to-get-php-to-play-nicely-with-svg-files/
Thanks again!
- This reply was modified 5 years, 10 months ago by WatcherJoshua. Reason: More details
- This reply was modified 5 years, 10 months ago by WatcherJoshua.
Forum: Developing with WordPress
In reply to: Display only posts from a specific category or post typeThe code is included in index.php on the home page of the website. The page includes the normal WordPress loop and then this query below that (where I want to show posts from only one post type that is excluded from the normal loop).
I just tried disabling all plugins and using the Twentynineteen theme with the same results: It displays all the same stories from the normal loop again and does not include any from the custom post type. It’s as if I had just included the same loop twice.