Within the context of WordPress Theme-ing, the term 'template' refers to PHP files used to display content.
0
votes
0answers
16 views
How to retrieve depth of menu into template
In wp_nav_menu i use for the menu, with custom walker, i can get the $depth parameter in the start_el function
function start_el(&$output, $item, $depth, $args)
but, outside this ...
0
votes
1answer
180 views
How to create template for taxonomy results limited by Custom Post Type?
I've got a Custom Post Type with a Custom Taxonomy set up. So how do I create an archive template to display posts from that CPT, limited by taxonomy?
Here's the deal:
The CPT is called Shows. Each ...
0
votes
0answers
26 views
Template for page with overridden Theme
I think I've got a somewhat uncommon issue. My wordpress site uses a custom theme, but I wanted to add a blog alongside that, without using multisite because my host charges 3x the amount for such a ...
0
votes
0answers
13 views
Different template and themes visible for different users
I'm trying to accomplish the following task:
Create a WP installation which will allow different users to:
see and manage posts and pages created only by them
see and change templates of their ...
0
votes
0answers
11 views
I need to include post template into home template
i need to include "blog_page_2_column.php" into homepage.
I do this, insert this
into homepage template, works fine but i cant change the page of blog...
Any idea?
The web is ucrburna2013.com.ar
Thx
0
votes
0answers
14 views
home.php and the first page of the archive
I have a home.php template file in our Wordpress blog that displays a special first page as the front page of our blog (Short post excerpts, posts from categories, photos, etc, etc).
Now I want to ...
0
votes
0answers
14 views
Taxonomy page to display top level category as field
i thought I had my issue fixed but I found out that it isn't.
I have code in the sidebar of my archive template that only displays the parent taxonomy terms as links to take you to the taxonomy ...
1
vote
1answer
210 views
Passing parameters to a custom page template using clean urls
I am now passing parameters to a custom template in the following format
www.example.com/?pageid=12&rid=24&title=this-is-the-title
I have created two tables . So I need to fetch data and ...
0
votes
1answer
116 views
Category Template: Need to display different content on first page of archives
So my issue is that I need to create two versions of a category.php template. Now, I know very well that if I want to display posts from just one category, I duplicate category.php and call it ...
0
votes
1answer
26 views
Template with Custom Post Type (Custom Tables) does not work
I'm using a Custom Post Type (CPT) my-project stored in a custom table MY_PROJECT.
Here is the CPT registering code:
$labels = array(
'name' => __( 'Projects ' ),
...
0
votes
2answers
30 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
17 views
Displaying hierarchical taxonomy terms on taxonomy template
Sorry if this is a little long but it is somewhat complex. I thought I was going down the right path. Here it is. I have created a custom post type and a custom taxonomy for it named location. In this ...
0
votes
1answer
18 views
Group pages by custom field values
I plan to have each individual product as a page, with custom fields for : Brand, size, feature 1 and feature 2.
My question:
Will it be possible to build a summary page template say for Brand, ...
0
votes
1answer
109 views
Show page title just from the first child-page in template
how can I do this:
Pages:
Home
- sub-1
-- sub-sub-1
--- sub-sub-sub-1
On home-page should only show the page-title of the first child-page like:
sub-1
I found this:
<?php $child_pages = ...
2
votes
1answer
34 views
Test if page is child and has children, if so echo child pages also on grandchild pages
I am trying to show a sub-menu of child-pages only on level 2 pages (who have a parent) and if they have children. I am using the code below (made from several snippets I found), it works fine on ...
0
votes
0answers
20 views
Permission denied in template-loader .php
Oh man.
I tried to create a custom page template for a page on my site
page-cumberland-principles.php
When I go to view that page, the page showed up completely blank.
I used wp_debug, and found ...
0
votes
1answer
31 views
How to find out which template the HTML content comes from?
At my page, I want to change the text "next" and "previous" at the bottom of the page, but I can't figure out which PHP template it derives from. I tried searching the classes that was connected to ...
0
votes
3answers
35 views
Is there a way to make this kind of loop shorter and nicer?
Here is my loop code, i want to call different page templates for different pages. Please notice that this is a one-page-layout.
<?php $args = array( 'post_type' => 'page' );?> <!-- get ...
0
votes
1answer
320 views
Custom Post Type Archive Template
I have similar problem to this one: Custom Post Type Template - Archive
So, I have a wordpress custom post type called coupon. I try to assing the template to it by using archive-coupon.php, but it ...
1
vote
2answers
3k views
Display a specific dynamic sidebar widgets on a specific page
I have had a wordpress site handed off to me halfway through completion. It's been at least a year since I last used wordpress and there are a lot of things I'm finding different. The way I am used to ...
0
votes
1answer
564 views
Site Title appearing twice on live site
My site template's header.php file has the following:
<title><?php wp_title ( '|', true,'right' ); ?></title>
Why does this produce the site title twice on each page?
0
votes
2answers
447 views
Customizing get_the_excerpt() to specific length and “Read More” output.
I am costuming a template. There is a list grabbing the introduction from the first 1-2 paragraphs (all the articles from a category). If I set the excerpt to 295 words, sometimes the list grabs ...
4
votes
5answers
172 views
How to show a under construction page for a domain but still be able to work on index.php?
I installed a WordPress for a domain name. When I use this domain name will point to index.php in my template. I want show a under construction page for this domain name, but the other hand I still ...
-1
votes
0answers
34 views
Static link in header.php only displays on single posts/pages
I would like to add a static link to my Wordpress theme's header.php file such that it appears on every page. However, after adding the new anchor element to the template, I find that it displays the ...
18
votes
9answers
16k views
get name of the current template file
I've found this to display the current name of the file used in template:
function get_template_name () {
foreach ( debug_backtrace() as $called_file ) {
foreach ( $called_file as $index ...
1
vote
1answer
52 views
How to prevent execution of default query, while preserving ability to use WP_Query in template?
PROBLEM: I'am trying to prevent execution of default WordPress query for custom category template. I have found a possible solution, but looks like it preventing execution of all post queries:
...
1
vote
1answer
16 views
get_search_link() redirects to 404 template page
I built a custom theme, and in it, there is a 404.php page and a search.php page.
Elsewhere in the template, I wanted to link to the search page directly. So, I used the get_search_template() ...
0
votes
1answer
30 views
Wordpress removing data attributes for scheduled post
Hi I'm using the smarty templating engine in wordpress to generate HTML like the one below:
<li>
<div class="checkbox_container" data-asin="B0009Y7APU"><input type="checkbox" ...
2
votes
1answer
90 views
Displaying a WooCommerce product via PHP
Having a hard time composing a searchable query, so I apologize in advance if this has been covered.
I know you can add WooCommerce products to a page or post via short code, but I have one section ...
1
vote
1answer
206 views
Show only 2nd level of navigation depending on active navigation
For example, suppose a menu like so:
Parent 1
Child A
Child B
Parent 1
Child C
Child D
Child E
Parent 2
Child F
In a certain part of my template, I want something to show depending on ...
1
vote
1answer
149 views
do_shortcode() doesn't work if shortcode contained in variable, works if shortcode passed as string
I'm developing a plugin, wherein one of the features is to switch out forms on a specific page by changing the shortcode within a custom field.
within my plugin file:
function getShort()
{
...
0
votes
0answers
43 views
Get image URL from media library in input
On wp-admin/post.php?post=447&action=edit for example I have a link and an input.
The link appears as follows:
<a href="#" class="button insert-media add_media" data-editor="tj_image_url" ...
0
votes
1answer
16 views
Query with no terms uses index.php template instead of archive.php
I'm using the Query Multiple Taxonomies plugin to get a page of search results (all of which are a custom post type - car).
If any search terms are added, so the url looks like this:
...
0
votes
0answers
11 views
Is there some way to put a theme's header.php and footer.php in a subdir [duplicate]
and still call them with get_header() / get_footer()?
For example {themedir}/templates/headers/header.php
of {themedir}/templates/footers/footer.php
With templates this is easy, but I can't get it ...
-2
votes
0answers
25 views
Can we use 2 seo plugin at a time [closed]
in my blog i'm using 2 seo plugins, google xml sitemap generator and robots meta. the problem is if i use robots meta along with google xml sitemap generator, google is not indexing my blog post. will ...
0
votes
3answers
91 views
bloginfo('template_directory') img src
I am lazy loading some images with URLs which are added via custom fields.
The lazy load plugin I'm using requires a place-holder image in the src attribute and the actual image in data-original.
...
0
votes
0answers
20 views
Single Post Template with Dropdown Option?
I'd like users of my theme to be able to select a single post template via a dropdown menu on the post screen.
I know of a plugin that achieves this but I would like to be able to achieve the same ...
1
vote
2answers
25 views
Generate Catalog Of Posts Based On Template
Is there a way to print a hierarchy of posts/pages/custom post types based on page template?
EG. I am often asked to review another web site and I'd like a way to 'see' all the pages that are ...
1
vote
2answers
433 views
add_rewrite_rule and template redirect not working
I have a strange problem , I have the following pairs :
add_rewrite_rule('^questions/ask/?','index.php?pagename=ask','top');
if(is_page('ask')){
$tname = 'add-question.php';
...
-1
votes
0answers
24 views
theme options panel [closed]
plz i need help to create simple options for a theme
this an example :
in theme i have this code
<div id="ticker-wrapper" class="no-js">
<ul id="js-news" class="js-hidden">
<?php ...
0
votes
1answer
58 views
Load php file with jquery in single.php
I implemented in my worpdress theme ios button switch and when someone click the button the script load a php file with the text: on or off
Here is the code:
<script type="text/javascript">
...
0
votes
2answers
26 views
implement separate templates for 1 post type
I have a custom post type 'courses', with a course description as post_content, and number of attachments
I also have a custom post type 'course units', linked to the courses with a custom field ...
0
votes
4answers
1k views
Wordpress not respecting template hierarchy (fetches index.php instead of single.php or page.php)
I've encountered a strange error while developing a custom theme.
After finishing editing the template for a custom post type single view, I passed onto working at the template files for pages and I ...
-1
votes
1answer
29 views
How can i hide content if not friend in Buddypress?
How can I hide some specific contents or div or other stuff depending on being friend or not in buddypress ??
I tried to use the bp_is_user_friends() function but it did not work !
0
votes
1answer
317 views
previous_post_link() and next_post_link() with a custom post type?
I'm on single-work.php for a custom post type called work, inside the loop.
Trying to make two links to the previous and next post.
Using this code:
<?php previous_post_link(); ?>
and
...
3
votes
2answers
98 views
Pass PHP variable to javascript
Is there any possibility to pass some PHP variables in javascript so I can use them later?
Only in single.php.
I heard about wp_enqueue_scripts but with that it is neccesary to declare a path to a JS ...
0
votes
0answers
5 views
Dynamic heading for page and sub-pages, while sub-pages display a description field from their grandparent page [duplicate]
I want to have a heading that dynamically changes when I change the section i.e. the About us section and all sub pages have a heading of About us and a sub heading description of a custom description ...
0
votes
0answers
29 views
Linking Attachment page to another attachment page of larger size
I am not sure is it really possible. I have a gallery. But few years ago, I did not cared to make the image size on attachment page full size. You know what I mean, attachment page shows default size ...
0
votes
1answer
54 views
PHP code rendered in HTML
I'm trying to find out why any template different than index.php doesn't work.
I've created a category-news.php file (also tried with category-4.php and mostly all alternatives), but when opening ...
-1
votes
2answers
39 views
stop blog page from using index.php?
I have a static homepage with a custom template I.E hompage.php the blog loop is set to a static page named blogg, it uses the index.php page as a template, there a collection of other pages using the ...

