Tagged Questions

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.

learn more… | top users | synonyms

0
votes
1answer
17 views

Theme parts path location dump

Few months back I was working on customizing theme that I was assigned to. I remember that I used some function or define something in the config or theme functions file and than it displayed debug ...
0
votes
0answers
30 views

Nested get_template_part / WP_Query – How should I do this?

I'm running a loop that runs a certain get_template_part, and that template file itself should then run another get_template_part, with the purpose to get some posts, is this even possible? At the ...
0
votes
1answer
31 views

How to pass variables with get_template_part?

I am developing a custom theme and i like to pass some variables to selected files. I am calling the view files from functions.php. $var1 = ; $var2 = ; etc ...
0
votes
1answer
30 views

Getting the chosen template when iterating through pages

Im trying print all the pages on a wordpress site. Im using the following code: $args = array( 'post_type' => 'page'); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) : ...
0
votes
1answer
177 views

WP_Query on custom post type not displaying, multiple loops & get_template_part

I'm having problems getting my testimonials to display. On page.php I have a testimonials section. So I have a loop that grabs the content for page.php, and then a get_template_part('content', ...
1
vote
2answers
133 views

Single Page Wordpress Theme - Using page templates

Well I am lost, its late and I have been searching google all night. Heres the problem I am running into. I am trying to create a singe page website using wordpress "pages". How I have initially setup ...
0
votes
1answer
59 views

Problem with Front-Page.php loading recent posts

Hi I this weird problem where i have my custom front-page.php with set page (in Reading Settings) static page. What I want to have is a static page with welcoming message and later 1 recent posts ...
0
votes
1answer
17 views

How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()

What is the best practice methodology for referencing the main loop from within the context of a secondary loop within a partial called via get_template_part()? For example, say my homepage contains ...
0
votes
0answers
16 views

How to unregister sidebar for template_part?

Can you help me please? I have this code in my index.php: php get_sidebar(); And I have a template_part 'loop-fullwidth', which I call in index.php. I need to register sidebar for index.php and ...
0
votes
1answer
45 views

Is it possible to call a template file inside wysiwyg editor? And how?

Is it possible to call a template file, say for example mycustomtemplate.php inside the default Wordpress WYSIWYG editor? I had this content. My team (This is my content inside the WYSIWYG) then I ...
6
votes
3answers
231 views

Is it possible to override the result of get_template_part()?

I'm working on a child theme, I strongly prefer not to override the main template files in order to maintain simplicity of the child theme as well as minimize the amount of code and maintenance over ...
0
votes
0answers
39 views

get template part

we have a dashboard for users. it's like front-end my page which is listed For example we have sub menus on this page. change my profile list of my posts list of my comments payment history my ...
0
votes
3answers
82 views

How can I see what template parts are being called for rendering the viewable page?

I have a theme where the developer used get_tempalate_part() a lot, and these parts are scattered across theme subdirectories as well as in directories in a plugin that was created to assist with the ...
0
votes
1answer
119 views

Get template part vs locate template function

I'm in single.php where I'm trying to get related-posts.php template. The problem is that when using get template part the related-posts.php isn't getting custom taxonomy name from single.php in ...
0
votes
0answers
175 views

How to get/display specific WP page with beloning page template in DIV (fullPage.js)

I've recently been trying out the really neat JavaScript snippet for fullPage-design from Alvaro Trigo. http://www.alvarotrigo.com/fullPage/. I use it togheter with WordPress with the purpuse of ...
0
votes
1answer
31 views

Passing a variable from the archive page to the default template

I have created an archive page that will display the whole content of list of posts. The individual post content output should be managed from a specialized that I will integrate using the WP built-in ...
0
votes
2answers
89 views

The use of get_template_part() returns 'invalid argument' loading options

I would like to avoid the include_once() in order to remove one INFO using Theme Check, and when I try to load my Options page using get_template_part('custom-options'); it returns the message: ...
1
vote
0answers
115 views

Change the file path on get_template_part via plugin

I'm trying to make a plugin that will change the behavior of a theme. In the theme file I have a get_template_part('libs/templates/user_menu');. I want to make my plugin "force" the ...
0
votes
1answer
46 views

Use of IF statement in Header file

I have a custom page template created. When I load my page, it shows the header logo of the mainpage but what I want to achieve is for each custom template created, I want it to only show its own ...
0
votes
2answers
98 views

Re-using single CPT code with get_template_part?

Wordpress newbie, here. I've created a custom post type, using CPT UI, named "menus". Later created single instances of that "menus" CPT, directed by a "single-menu" template. So here's my hierarchy ...
0
votes
1answer
39 views

Is this correct get_template_part() in WordPress?

I just want to show the slider structure if it has posts... is this correct? <?php if ( (have_posts() ) { get_template_part('slider'); } ?> I think that works but I'm not sure if is ...
1
vote
3answers
93 views

Some doubts about how to show posts in a custom theme?

I am pretty new in WordPress theme development and I have some doubt about this WP function used to show my post in the homepage: <?php if ( have_posts() ) : // Start the ...
0
votes
0answers
15 views

get_template_part within plugin [duplicate]

TL;DR: How do I use something similar to get_template_part from within my plugin? I've created a custom filtering course listing for a school that queries posts to display what matches the user's ...
0
votes
2answers
183 views

Template tags vs get_template_part() vs functions.php

When to use template tags and when to use get_template_part() and when to use function.php? I am confused at them. For example, if I want to show related portfolios under single portfolio, I can ...
0
votes
1answer
208 views

get_template_part() to render single page Theme

I´m developing a single page theme and want to render all pages with their respective templates on a single page. I know I could make a query and write the markup for the respective page, but I prefer ...
0
votes
2answers
83 views

Including template pages within another template?

I've created a vertical page template which displays stacked sections (which are simply the content from other wordpress pages). I am having problems displaying the contents of pages which are ...
0
votes
1answer
168 views

How to include a file using get_template_part() in a plugin?

A very simple question may be, but I'm struggling. In theme development, I worked with get_template_part() many times, and I understand its basics. But when I's developing a plugin, I wondered using ...
0
votes
1answer
167 views

get_template_part function and add images

Added this function in any page: get_template_part('recent', 'posts'); And: if(have_posts()){ while(have_posts()){ the_post(); ?> <div class="site-content clearfix"><?php ...
0
votes
2answers
180 views

Get Specific Template Part if Custom Field is Some Value

I have a problem and I don't know how to solve it. I tried some solutions but I failed since I am not good programer. I also tried to find a solution, but there is no similar question asked. So... ...
0
votes
1answer
129 views

Tag page only display 10 posts

I've had a problem with this for quite some time now and cannot for the life of me figure it out. I am using Multi-site and not sure if that has anything to do with it or not, so keep that in mind. ...
0
votes
1answer
87 views

get_template_part() isn't loading author information

Using get_template_part() I parted some of my theme's common post templates. My post template is content-general.php. Without parting thing is going fine. But just after parting the template — ...
0
votes
1answer
103 views

How return normal search result using wp_ajax action for wordpress

I want the normal search result to be available when using the wp_ajax action. Is there a way to do execute the normal WP_Query for the parameters that are available in the current request? This is ...
0
votes
2answers
56 views

Is there a way to call on just the content of a Page without actually using that Page? [closed]

The question sounds weird i know, but what i'm trying to do is add a gravity form into a template that i made. But all of their tutorials seem to be more along the lines of adding a form to a page ...
1
vote
1answer
93 views

Get_template_part inside a folder

So I've the following code in order to search for templates inside a custom theme I'm working on: <?php $my_theme = wp_get_theme(); get_template_part( 'masthead', $my_theme->Template); ?> ...
0
votes
1answer
89 views

Is “get_template_part” hierarchy possible?

I'm build a custom Wordpress theme using get_template_part to call tiny bits of code. I have file called "masthead.php" that is called using this code: <?php get_template_part( 'masthead' ); ...
0
votes
1answer
255 views

get_template_part() doesn't work

I use get_template_part() function to get theme options page content like this: function setup_theme_admin_menus() { add_theme_page( "Theme Options", "Theme Options", "read", "theme_options", ...
0
votes
1answer
660 views

Where is the template for the 'standard' format of a post in the theme twentythirteen?

I have selected the 'standard' format for a post: I am now trying to edit the layout of posts, in index.php I can see the following line: get_template_part( 'content', get_post_format() In the ...
0
votes
2answers
220 views

Too many get_template_parts?

For a lot of my site I'm using get_template_part mostly because I had coded most of it in html/css first and it just seemed easier to call each part as I saw fit. My question is, basically, will this ...
0
votes
3answers
313 views

Get template part based on custom taxonomy term

I have a custom post type and I'm trying to call up different variations of the navigation based on the custom taxonomy slug. I've done this fairly easily with normal posts, like so: <?php ...
0
votes
0answers
95 views

query_post while (have post) get_template_part()?

My goal: Is to give the user the ability, if they so choose, to create a new category. I have the current categories saved in a separate php file and call them in using get_template_part(), there ...
1
vote
1answer
35 views

Valid HTML in Template Part

in a custom plugin I have a WPQuery, which looks like the following: $sticky = get_option( 'sticky_posts' ); $args = array( 'post_type' => 'mission', 'ignore_sticky_posts' ...
0
votes
1answer
3k views

Correct way to use get_template_part() and get_post_format() with custom post types?

I have a custom post type of 'competitions'. In order to customise the display for this CPT in, for example, category listings I am doing the following: Create a category-competitions.php file ...
0
votes
1answer
60 views

Is it possible to have a Theme with built-in physical page files?

I am creating a theme and was thinking if it would be possible to create pages within my theme folder that would reflect the wordpress url + path. So for example I could when accessing: ...
1
vote
1answer
37 views

Problems with loop

I have this loop in my index.php: <?php if (have_posts()) : while (have_posts()) : get_template_part( 'post' ); endwhile; endif; ?> which calls ...
0
votes
1answer
135 views

get_template_part in admin

I am trying to use get_template_part when creating a page in the admin section of my site. However, it does not seem to be working. Does this function not work in the admin section? What alternative ...
0
votes
2answers
78 views

Remove portion of header code from home page only

I have this code in the template file header.php: <div class="dynamic-header"> <?php if(function_exists('show_media_header')){ show_media_header(); } ?> </div> I want to ...
2
votes
1answer
1k views

get_template_part from plugin

This is default get_template_part function inside WordPress: function get_template_part( $slug, $name = null ) { do_action( "get_template_part_{$slug}", $slug, $name ); $templates = array(); ...
0
votes
1answer
263 views

Conditional get template part

My index page look like this... <div id="ad-id">google ad code goes here </div><br /> <div id="post-id">My posts are goes here</div> I use ...
8
votes
3answers
1k views

Is there any way to use get_template_part() with folders?

I'm wondering if there is any way to use get_template_part() with folders? My main folder has a lot of files now because I put every re-usable element in a separate file. I'd like to put them in ...
1
vote
2answers
382 views

Using get_template_part to retrieve a template file based on current post type

I'm trying to use get_template_part to retrieve a template file based on the current post type (slug) the user is in. The template file just includes an image that is used specific to specific post ...