The template code is very simple –
<?php?/*?Template?Name:?my-template-name?*/
namespace?My_Namespace;
if?(current_user_can("read_my_custom_component"))?{
??get_header();
??while?(have_posts()):?
????the_post();
????//get_header();
?????>
????<div?id="primary"?class="content-area">
????????<?php
????????the_content();
?????????>
????</div>
????</body>
????</html>
????<?php?
????endwhile;?>
??</body>
??</html>
??<?php?
}?else?{
??wp_redirect(esc_url(wp_login_url()?.?"?redirect_to="?.?home_url(?$wp->request?)));
}
?>
The error I get is “The preview could not be loaded”
I am able to edit pages using this template with the default WordPress editor
All plugins are disabled except Elementor and the one which defines my page template, capability etc. All plugins are on the latest version. No error appears in debug.log. Elementor system info is at https://pastebin.com/basEifwV
Thanks
]]>I want to add the page template and SEO metas to page revisions. I’ve been updating a lot of pages to new page templates, and it would be really helpful to know when the page template was updated, as well as the content added. We also regularly update SEO metas, and for legal compliance issues, we need a record of when this is done. I would like this information to be available in the page editor, and in the REST API.
I have the field names for everything I need… the page template is saved as “_wp_page_template” and Yoast data is saved in formats like “_yoast_wpseo_metadesc”. When I add these to the revisions using the “wp_post_revision_meta_keys” filter, though, it doesn’t seem to be affecting anything. (I am basing my code off of the sample function at https://make.www.ads-software.com/core/2023/10/24/framework-for-storing-revisions-of-post-meta-in-6-4/.) I don’t see anything new in the page revisions, there’s nothing yet in the revisions in the database, and I am also not seeing this information in REST API.
Just to be clear, I know it won’t show me *past* revisions. I’m testing this by saving new information on a post. I also don’t have any errors in the debug file.
Is there a different hook or filter I should be using?
]]>The search field input box, and the content that was on the search page has all vanished, only the title remains. That makes sense though as all of this was on the page template file, which I had called searchpage.php
I searched around and see the process for selecting page templates was changed sometime around WP 5.8. Now there’s meant to be a box or option called “Templates” in the sidebar, along with the usual things like Publish, Page Attributes, and Featured Image, but Templates is not visible on the editor page sidebar (see screenshot: https://imgur.com/a/t529U1o).
Has anyone else seen this? I made the theme myself in May 2022 (as I have a couple of times since adopting WP in 2007) so cannot get support from a theme developer. I’m no pro, I just followed the then latest guidelines in the WP codex, plus the info on a couple of reputable WP blogs, when creating the theme last year. The site has otherwise functioned perfectly since I built the theme.
A few other things: I’m running the latest version of WP (6.2.2), and all plugins are up to date. I also use the classic editor plugin, but when I switched over to the Block Editor it made no difference.
Any advice would be greatly appreciated
]]>Maxi Blocks has a nicely designed Template library and you can easily style the templates by using one of the predefined style cards. And you can edit the style card like changing colours and fonts and then you can activate them accross all the templates on your page.
I’ve just started playing with it. It seems extremely powerfull too. A small wish would be that the style cards would work cross site instead of on per page basis. You can however easily select a style card you set on another page though.
I did a small test and it didn’t really affect the pagespeed.
]]>The whole site, according to the old habit, is made of pages.
Unfortunately, due to the fact that Russian words are quite long (for example, the word “Pharmaceutical” placed in the title does not fit into the line when viewed from a smartphone), I use the No Title layout.
The title is now the first line on the site page.
Setting up this page was quite a hassle, and now for the new page I duplicate the main page and then redo it.
It’s long.
I read that can create page templates yourself and made it.
I made a test page and applied the template I made to it.
What was I waiting for?
I was expecting that the page, when applying the new template, would be transformed in the administrative part, and I would be able to remake it to the one I need, fill it with text.
That did not happen.
Then I looked it up on the net – and hooray, it began to look right!
I clicked on the Edit page button – I was thrown into the administrative part – and I see the test page again.
I tried everything yesterday, but there is no other way – I see my template on the web, it is linked to the page – but I cannot edit it.
Please tell me what I did not take into account and what I am doing wrong?
Thanks
Default template
Blank
Full Width
All the Blockify templates are shown in the Full Site Editor (Appearance > Editor > Themes Editor > Templates) but not in the drop down:
404
Archive
Blank
Front Page
Full Width
Index
Page
Search
Single
Created my own templates based on these, with different names, but not sure why the Blockify templates are no longer selectable. Is there a limit to the number of templates that can appear in the Templates drop down when creating / editing a page?
]]>