The shortcode is supposed to display a book grid from Mooberry Book Manager plugin, six book covers horizontally. But when in the page template it comes out with them stacked vertically.
Developer of the book plugin has investigated and reports “After thorough inspection of the code on the home page vs other grids, I discovered that on the home page, the code that is being displayed is not what MBM is generating. It’s like somewhere between the shortcode in the template and it being displayed in the browser, the template is re-writing the output of the shortcode”
Has anyone else had issues with this same thing or similar? How did you resolve it?
Thanks
]]><?php
/**
* Template Name: Artists List
*/
?>
<?php get_header(); ?>
<div class=”full-width-content”>
<h1>This is a full-width page template</h1>
<?php the_content(); ?>
</div>
<?php get_footer(); ?>
From what I read, this template should appear in the theme Editor, so that when I create a new page, I can select it. But I don’t see it.
]]>I would like to be able to change the background image on a per-page basis, or eliminate it completely in some instances. For example, I’d like to use a different image here: https://microburst.news/staging/donate/
It looks like the line of CSS responsible for setting the background is:
element.style {
background-image: url(https://microburst.news/staging/wp-content/uploads/2024/03/saguaro-hero-image.jpg);
background-size: cover;
}
It seems like it should be a simple matter to just override this CSS on a per-page basis with a different file name, or set the background to none. But I don’t see how I can do that.
]]>can this be done with custom form from forminator?
]]>I develop wordpress sites based on unique design and that’s why I always use custom page templates for different pages (for different content and design) on the sites. My problem is, whenever I choose a page template for a specific page, the restriction is not working on the page anymore. If I use the default page template, it works, but with custom page templates, it doesn’t.
I create the page templates in the theme’s php files, with Template Name function, and after that I set the page template at the page’s admin area.
What am I missing? Is there any option what I didn’t know? Please help me find a solution for this.
Thanks
]]>Also tried another block theme with a Pages template. It would not allow me to save it either.
]]>Now i want to get this as page template. I look forward to create the page template using theme editor. It let me create the template but not able to write the JS and PHP code. I m familiar with old theme where we can just copy page the existing page PHP template and start designing the page.
I tried to read the template creation online. i landed on topic which talk about the functiton.php but i donot know how to call the function as all the i m seeing the HTML files under the template section.
This theme twentytwentyThreee seems has new style and programming. It will be good if you provide me step-by-step guide to get the my php file as template and run seemlessly without lagging..
P.S. i m familiar with programming. Just looking for guidance
Regards
]]>I’ve been testing with the Twenty Twenty Three theme, and I’ve built the following custom page template for testing purposes:
<?php
/**
* This is a test custom template for Twenty Twenty Three.
*
* Template Name: Test Custom Template
*
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
$title = get_the_title();
$site_name = get_bloginfo('name');
$page_title = $title . ' - ' . $site_name;
?>
<title><?php echo $page_title; ?></title>
<?php
/*
You have to run the do_blocks() between the <head></head> tags in order
for WordPress to load the corresponding CSS.
*/
// Spacer block.
$str = '<div
style="height:32px"
aria-hidden="true"
class="wp-block-spacer"
></div>';
$block_spacer = do_blocks($str);
// Content block.
$block_content = do_blocks(
'<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:post-content /-->
</div>
<!-- /wp:group -->'
);
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div class="wp-site-blocks">
<header class="wp-block-template-part">
<?php block_header_area(); ?>
</header>
<main class="wp-block-group">
<div class="wp-block-group has-global-padding is-layout-constrained">
<h1 class="wp-block-post-title">
<?php echo $title; ?>
</h1>
</div>
<?php
echo $block_spacer;
echo $block_content;
echo $block_spacer;
?>
<div class="wp-block-group has-global-padding is-layout-constrained">
<div class="entry-content wp-block-post-content is-layout-flow">
<?php
echo '<p>Here is some text from PHP.</p>';
?>
</div>
</div>
<?php echo $block_spacer; ?>
</main>
<footer class="wp-block-template-part site-footer">
<?php block_footer_area(); ?>
</footer>
</div>
<?php wp_footer(); ?>
</body>
</html>
The problem is that the elements that should be right-justified, like the navigation menu and footer credits, are not:
I can fix the layout by running do_blocks()
on the header and footer in a second custom page template like this:
<?php
/**
* This is a test custom template for Twenty Twenty Three.
*
* Template Name: Test Wrong Header and Footer, Fixed Layout
*
*/
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
$title = get_the_title();
$site_name = get_bloginfo('name');
$page_title = $title . ' - ' . $site_name;
?>
<title><?php echo $page_title; ?></title>
<?php
/*
You have to run the do_blocks() between the <head></head> tags in order
for WordPress to load the corresponding CSS.
*/
// Header block.
$str = '<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:group {"align":"wide","style":{"spacing":{"padding":' .
'{"bottom":"var:preset|spacing|40"}}},"layout":{"type":"' .
'flex","justifyContent":"space-between"}} -->
<div class="wp-block-group alignwide" style="padding-bottom:' .
'var(--wp--preset--spacing--40)">
<!-- wp:site-title {"level":0} /-->
<!-- wp:navigation {"layout":{"type":"flex","setCascading' .
'Properties":true,"justifyContent":"right"}} /-->
</div>
<!-- /wp:group -->
</div>
<!-- /wp:group -->
';
$block_header = do_blocks($str);
// Spacer block.
$str = '<div
style="height:32px"
aria-hidden="true"
class="wp-block-spacer"
></div>';
$block_spacer = do_blocks($str);
// Content block.
$block_content = do_blocks(
'<!-- wp:group {"layout":{"type":"constrained"}} -->
<div class="wp-block-group">
<!-- wp:post-content /-->
</div>
<!-- /wp:group -->'
);
// Footer block.
$str = '<!-- wp:pattern {"slug":"twentytwentythree/footer-default"} /-->';
$block_footer = do_blocks($str);
wp_head();
?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div class="wp-site-blocks">
<header class="wp-block-template-part">
<?php echo $block_header; ?>
</header>
<main class="wp-block-group">
<div class="wp-block-group has-global-padding is-layout-constrained">
<h1 class="wp-block-post-title">
<?php echo $title; ?>
</h1>
</div>
<?php
echo $block_spacer;
echo $block_content;
echo $block_spacer;
?>
<div class="wp-block-group has-global-padding is-layout-constrained">
<div class="entry-content wp-block-post-content is-layout-flow">
<?php
echo '<p>Here is some text from PHP.</p>';
?>
</div>
</div>
<?php echo $block_spacer; ?>
</main>
<footer class="wp-block-template-part site-footer">
<?php echo $block_footer; ?>
</footer>
</div>
<?php wp_footer(); ?>
</body>
</html>
That fixes the layout (you can see it on the test site via the “Fixed Layout” menu item), but doesn’t display all the header blocks I added and shows the default credits instead of the copyright I added via the Editor:
Adding a PHP-based custom template is so easy with the old, non-block-based themes, but this is giving me fits.
I found this article, which helped get me started, but I haven’t been able to find any documentation for adding PHP-based custom templates for block themes, and the current Page Templates document is still geared to non-block-based themes, it seems.
How do I get WordPress to load both the CSS I need to fix the layout and the correct content for the header and footer?
Or is there a better way to run a PHP-based page in a block theme?
]]>I have an issue with single job page layout. It’s as a blog post (with sidebar, related news etc…). Is there a way to change layout and have only the job content ?
]]>