Skip to main content

Questions tagged [get-template-part]

It is a WordPress core function that loads template parts inside theme templates. It makes it easy for themes to reuse sections of code like pagination, header images, menus, etc.

0 votes
0 answers
61 views

<?php /** * Data provider for block patterns. * * @package Test */ namespace RomArt\DataProviders; /** * BlockPatternsDataProvider class. */ class BlockPatternsDataProvider extends ...
Tahi Reu's user avatar
  • 308
0 votes
1 answer
34 views

I am trying to add a template sections that I have in a directory my-child-theme/template-parts/hero.php. In my page template (my-child-theme/templates/front-page.php) I am calling echo ...
J W's user avatar
  • 3
1 vote
0 answers
41 views

I am building a project using WordPress 6.6.1. I have opted to create a child them which extends TwentyTwentyFour and therefore relies on the new block editor which is packaged in that parent theme. ...
GRY's user avatar
  • 123
1 vote
1 answer
68 views

When I open up my WordPress site, and on the admin - settings - reading I define Your home page display posts as "Your latest posts" The homepage is displayed by home.php and /blog/ is ...
Ronen Yahaloms's user avatar
0 votes
1 answer
241 views

I have a homepage and an archive page where I call a template part to have a hero section for the most recent posts, and then loop through the remaining posts as usual. Essentially I don't want to ...
lastnoob's user avatar
  • 163
0 votes
1 answer
85 views

I'm using a template part to repeat the HTML for each result when performing a WP_User_Query to return a list of users. However I am finding that the Advanced Custom Fields data isn't returning. // ...
greatsplott's user avatar
0 votes
0 answers
64 views

I use an ajax called to get all posts of a custom post type and other criteria. I would like to get the response of my ajax called and use it in a template php file. So my question is : how can I pass ...
davidb45's user avatar
0 votes
0 answers
39 views

This is how my index.php looks like for my custom theme (I'm not sure if Line 4-5 is necessary). When I put pagination in the home or post, I would like to be able to take the user to a separate ...
Elaine Byene's user avatar
0 votes
1 answer
2k views

I have this simple template in a my_template.php file: <div class="popup_canvas_container"> <p>This is a template I'm gonna load</p> </div> And I implemented ...
Luigino's user avatar
  • 103
0 votes
1 answer
3k views

I am including HTML template in my shortcode by using ob_start & ob_get_clean. Everything works normally but the returned HTML structure is broken. this is how I am inlcuding the html template in ...
StealthTrails's user avatar
0 votes
1 answer
567 views

I was faced with a minor issue but can't solve it myself. I need to add the value on the variable after all loop iterations. And nothing problem, but I need to use this variable in the other file. for ...
Victor Sokoliuk's user avatar
0 votes
0 answers
388 views

I'm a big fan of the introduction of the $args parameter in get_template_part() since WP 5.5... or rather I would be, since I can't make it work and must still rely on [set|get]_query_var(). The call ...
Marks's user avatar
  • 31
0 votes
0 answers
639 views

This is the function im using: function change_title_h1_h2( $title, $id = null ) { return '<h2>'.$title.'</h2>'; } add_filter( 'the_title', 'change_title_h1_h2', 10, 2 ); Is there ...
will's user avatar
  • 9
0 votes
0 answers
109 views

I can't seem to find a solution to actually loading a template, passing arguments to it, executing it, and displaying the results from a shortcode registered via functions.php Is this even possible? I ...
WASasquatch's user avatar
0 votes
2 answers
281 views

this is a bit messy and I cannot understand why my approach isn't working or what my error is. I'm using a template part to include a custom wp_query into my theme. I'd like to have two different ...
Gatto Nero's user avatar

15 30 50 per page
1
2 3 4 5
14