The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
0answers
21 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
26 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
39 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
32 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
60 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
79 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
67 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
76 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
76 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
65 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
85 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
92 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
59 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
84 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
49 views

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

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 ...
0
votes
1answer
49 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
0answers
41 views

Use Custom Post Types, Get Template Part or Both when dealing with Taxonomies?

My Question headline might suck in which case any suggestions would be great:) I am having an issue with understanding in which context i should use and create a content-page.php vs. just calling in ...
0
votes
1answer
60 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
71 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
394 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
113 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
184 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
85 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
33 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
1k 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
45 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
33 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
86 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
0answers
29 views

when implementing a “GET_Template_part”, something weird happens

OKay, i read the wordpress codex about get_template_part. i get it work, BUT, when it load the .php, it actually prints out the text/word: get_template_part() right before the rest of the ...
0
votes
2answers
67 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 ...
0
votes
0answers
93 views

Posts 2 Posts, losing connection in template parts

I am using the Post 2 Posts plugin to connect different post types. My code works perfectly when it's all in one file (archive.php). The problem I have is taht I want to split out the part that does ...
2
votes
1answer
713 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
195 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 ...
7
votes
3answers
749 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
216 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 ...
1
vote
1answer
171 views

Checking whether template part is loaded in a page

I have a template part like this: <nav id="subpagemenu" class="sidebar"> <?php get_template_part( 'nav', 'subset' ); ?> <?php get_sidebar(); ?> </nav> Both of these ...
3
votes
1answer
214 views

Is it safe/recommended to use wp_enqueue_script function outside the functions.php file?

I created multiple post formats, and when i use an audio post format, i want to include some additional javascript for the audio player. So, i include the content-audio.php like this: <?php ...
0
votes
1answer
199 views

Use a separate template for the home page only

I use Pinboard theme (it has a very complicated structure, but it is nice). Image how it works Select a template in this way it changes for all posts, pages, etc. and do not give you more choice. I ...
0
votes
2answers
111 views

Organize template parts and page templates in folders in regards of template hierarchy

Hello and happy new year Suppose one has a large theme composed of several post types, page templates and a bunch of custom loops and template parts which is best keeping in separate php files. ...
0
votes
4answers
342 views

How do I display an image before the first post of the loop when I'm using get_template_part?

I have used $count before, but never run into this problem. I cannot get it to work. I have limited php background, so please be patient with me! Here is the $count setup code: <?php $count = ...
1
vote
1answer
702 views

How to localize inline script called with ajax

I have a loop of posts and I allow a user to edit each post using ajax. When the edit button is clicked for the post I use ajax to retrieve the template part containing the edit form for the post. ...
2
votes
2answers
2k views

Using a custom WP_Query with get_template_part loop

I have a query for a custom post type: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $books = new WP_Query(array( 'post_type' => 'wiki', 'posts_per_page' => ...
-1
votes
2answers
327 views

First post outside of loop, homepage only?

Because of the way my templates are structured, I need to pull the first/sticky post from the site outside of the standard loop, just on the homepage. I'm using _s (underscores.me) as a base, so the ...
2
votes
1answer
1k views

passing argument to get_template_part() or a better way to code

I have this include … event-list.php <?php /** * The loop that displays upcoming events */ ?> <ul class="event-items"> <?php $yesterday = time() - 24*60*60; $args = array( ...
6
votes
4answers
412 views

Is there a variable for a template parts name?

One you have called a template with get_template_part() (or locate_template()) is there a way to know what template you are in. For example if you call get_template_part('loop','archive'); from ...
2
votes
2answers
364 views

How to move style from template file to <head> section?

Imagine the following situation: //header.php contains: <header id="header">logo and navigation</header> //my-template.php contains: <?php get_header(); ?> <style ...
0
votes
1answer
315 views

How do I get standard posts to open up in their own template when using get_template_part()?

It seems to me that twentyelven opens standard single posts using the file content-single.php yet when I try the same code and files they open for me in content.php here's the code I have in ...
0
votes
2answers
746 views

how to replace get_template_part('loop','tag') with explicit styled version?

So my theme has a tag.php, that contains this line: get_template_part('loop','tag'); that runs the loop and spits out the tag entries. I'm modifying it to include post thumbnails (using ...
1
vote
2answers
853 views

get_template_part() - post-meta not working?

Maybe I simply do not understand what get_template_part() is doing … I have a file called event-list.php that should work as template for other pages and files so all my events (a custom post type) ...