Tag Info

New answers tagged

0

The following bypasses wordpress by not going through index.php: http://prompter.rareapps.org/prompter.php?p=2193 I'd recommend that instead of doing that, you place prompter.php in your theme directory and then hijack the page to display when someone clicks the link to view full screen using the template_redirect filter: function ...


0

Normally, copying index.php file for the theme as search.php will let you have a new base template to work off of with the same styles and look as your theme, assuming the theme implemented index.php decently. That would give you a solid start to be able to make changes to provided nothing is using a hook such as template_redirect to hijack the search ...


1

You can do this in one loop without as custom query. A couple of clever functions should get you there So lets look at a solution. First things first. I would suggest to separate your code completely here for easiness of reading and organisation. Roll back the changes in content.php and use this template only for all other templates. Create a separate ...


0

Ok, I've had a major breakthrough with the multiple loops on the smaller thumbnails and managed to find an answer to question 1. I now just need help with the answer to question 2! Here is the updated code for the thumbnail rows within one loop: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' ...


0

Have you looked at October CMS? The only reason I didn't use it for my newest project was because of SEO. Yoast's plugin on WordPress just handles a lot of stuff I don't want to deal with regularly.


1

Combining wordpress with other frameworks will make it very easy for you to shot yourself in the foot. If all what your clients want is an editor then you can just use tinymce without dragging the whole of wordpress into it, but if they are after the workflow and flexibility then it will be pointless to try to make wordpress something that it isn't. you are ...


0

in your post loop. use this code. <?php while (have_posts()) : the_post(); $post_type = get_post_type(get_the_ID()); if($post_type !='post'){ get_template_part('content-' . $post_type, get_post_format()); } else { get_template_part( 'content', get_post_format() ); ...


2

The thing about WordPress, while it doesn't have a neat routing system in principle it does same operation. It takes the URL input and matches it to a set of query variables. The not–neat thing about it is that it uses regular expressions for these not–quite–routes and a lot of them. The total number of rules fluctuates from about a hundred minimum to ...


0

You could do something a little more like merge fields. So you can keep your html and php separated by have an email template with placeholders and run a string replace on them, something like the following: html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html ...


0

You should use ob_get_contents() ob_start(); include('template/email-header.php'); printf(__('<p>A very special welcome to you, %1$s. Thank you for joining %2$s!</p>', 'cell-email'), $greetings, get_bloginfo('name')); printf(__('<p> Your password is <strong style="color:orange">%s</strong> <br> Please keep ...


1

I solved it. SOLUTION: <?php if ( has_term( 'downloads', 'listen', $post->ID ) ) { get_template_part( 'templates/content-downloads-vergriffener-baende' ); } elseif ( has_term( 'untersuchungen', 'listen', $post->ID ) ) { get_template_part( 'templates/content-untersuchungen' ); } elseif ( has_term( 'studien-materialien', 'listen', ...


0

I would suggest you copy page.php into your custom template, and then modify the code as required. At the very least, your template should look something like: <?php get_header() ?> <?php while ( have_posts() ) : the_post() ?> <article <?php post_class() ?>> <?php the_title( '<h1 class="entry-title">', ...


0

I noticed that your goal is to have an editable content on the search result. You can use another method to do that, by calling the content of the page from your search.php file. You can start by creating a page with the slug search-page as usual. You can also add post meta / custom fields as you need. And now you can start editing the search.php. Inside ...


0

Twenty Twelve adds for instance the CSS class .full-width to the body_class via a filter function in functions.php of the theme when the buld-in 'Full-width Page Template, No Sidebar' template gets used. Corresponding code from Twenty Twelve: if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) ) $classes[] = ...


2

Those classes are output by the body_class function, which can be filtered by plugins to add their own classes. You don't need to (and shouldn't) harcode classes into the body tag in your template, just add that function within the body tag: <body <?php body_class(); ?>>


1

your callback function must be like this: function cienna_show_slider_callback() { global $post, $product, $woocommerce; // just in case if your template file need this ob_start(); ?> <?php woocommerce_get_template( 'archive-product.php'); ?> <?php $output = ob_get_contents(); ob_end_clean(); echo $output; die(); }


1

I think that the most important question here is, Does this functionality add functionality to my theme or to my site? Page templates in general are theme territory and in my opinion should stay in a theme. This does not mean any functionality on which a template depend should be in the theme as well. These meta boxes that you are talking about can either ...


1

Since WP 3.4 page templates can be stored in theme root folder or direct sub-directoryr, that is no problem. But rename page templates, which include moving files to other directories, will unassign that page templates for all pages currently using it. To reassign the page template, simply edit the page, and reselect the desired template. About the ...


4

I installed the Lite version of this theme on a test site and dug around. The function that generates the slider doesn't provide any useful filters. However, it does store the IDs of the featured posts in a transient, so you could use the pre_set_site_transient_' . $transient and transient_' . $transient filters to reduce the number of posts. It also ...


1

There is no build in template assigment for indivual standar posts from edit screen. But you can assign templates for individual posts. There are several options: Use WordPress template hierarchy system Under the root folder of your theme you can create this files: single.php for all single posts of any type. single-post.php, if this file exists, it will ...


2

It is not possible to override header/footer via hooks in respective get_header()/get_header() functions. However it is often overlooked that these function allow input and loading different headers. For example get_header( 'nested/header' ); will look for header-nested/header.php in theme's folder. It's kind of a hack in regards to subdirectory use, but ...


0

Reading the codex on get_template_part and get_post_format will help you a lot here. It's hard to say for sure without knowing what files are in your theme but get_template_part( 'content', get_post_format() ); is essentially saying use the template named content-format.php, where format is one of image, video, gallery etc. One of a few things is happening: ...


0

A simple way to do is to edit your theme's "search.php" (copying it from the parent theme into your child theme's directory first if you're using a child theme) and then before the posts loop putting something like: <?php if ( $tag = get_term_by( 'name', get_search_query(), 'post_tag' ) ) { ?> ...


0

You can use : <?php $args = array('post_type'=>'your-post-type','post_status'=>'publish','posts_per_page'=>9999) $query = new Query($args); if($query->have_posts){ while($query->have_posts()) { $query->the_post(); //Do whatever display you want here } } ?>


1

Thanks again to cybmeta for his comments in my earlier question. Of course the solution is to use an archive template. The filename will be archive-foobar.php. The target URL will indeed be mydomain.com/foobar. This works fine, even though for my purposes "archive" is a misnomer. The end user never sees the word "archive". Additionally, using the notes ...


0

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code To get back to what you actually need, you have to remove the filter and all ...


1

Wordpress saves page templates that is assigned to a specific page in the db in the wp_postmeta table. These are saved as follows: 'meta_key' => '_wp_page_template', 'meta_value' => 'NAME_ OF_TEMPLATE' With this in mind, you can loop through pages which shares a specific page template, using get_pages (You can also make use of WP_Query) Example: ...


0

template_redirect is an action, it expects nothing to return back. What you are looking for is template_include filter I think. http://codex.wordpress.org/Plugin_API/Filter_Reference/template_include


0

Use get_template_part, for example if your template is named sale.php you can use: get_template_part( 'sale' ); http://codex.wordpress.org/Function_Reference/get_template_part



Top 50 recent answers are included