Tag Info

New answers tagged

-1

try changing the value of 'posts_per_page' => '-1' this is what's probably messing up your query, if you want two try setting it to : 'posts_per_page' => '2' also try to comment it out..... I think it's quite self-explanatory, but to really understand wp-query read the Codex ref..


0

It depends on the skill level of your final user, but for most of them HTML is hard (and it is hard when you try to achieve specific complex layout even for people with technical knowledg0e), therefor the less your users will have to write HTML the more happy they are likely to be. If you can eliminated the need for understanding HTML by writing templates ...


0

If you are using posts (rather than pages) and categories, you could do this by creating a custom archive template for all posts in the category books. As an example, this is the category page of "Image of the Week" on a photography blog. http://blog.keithberr.com/category/image-of-the-week/ In this case I copied category.php and saved it as category-21.php ...


0

I use multiple templates, but also use code for some pages. For example, if I have a site with 3 sections, About, Products, and Research I would create page-about.php, page-products.php and page-research.php. These can be customized as necessary though usually they are simply pulling in unique sidebars which I want to include on all pages within that ...


1

Assuming that you're on a page template or a custom page template, the first thing you want to do is grab the current page ID, then use that ID to grab the children. Once you have the children, display the content for those children. Try using get_children(); You can also try get_page_children but for my example, I'm using get_children: <?php ...


4

You have totally missed the naming convention when coming to the taxonomy archive pages, and most probably the same goes for your archive pages for your custom post types Here is how your taxonomy archive pages should look like taxonomy-{taxonomy}-{term}.php - If the taxonomy were sometax, and taxonomy's term were someterm WordPress would look for ...


1

First off, it sounds like you might be able to solve your underlying question using BuddyPress. If you simply want to make an actual WordPress page if a user registers you can do that using the user_register hook. The hook receives the newly created user ID. This code example should create a page with the user's nicename. add_action( 'user_register', ...


1

First of all, a taxonomy-{taxonomy}.php file is an Archive Template and not a good name for a custom template. So if you want to proceed with a custom template, try naming the file with something like template-cities.php and call the file to a Page. Otherwise, make a simple taxonomy-{taxonomy}.php archive template, and in your case taxonomy-city.php with ...


0

$query= new WP_Query(array( 'post_type' => 'page', /* overrides default 'post' */ 'meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/{template name}.php' )); This worked for me because my custom theme used page-templates folder.


0

I've been trying to figure out a solution for this too - I have a plugin with custom post types, those custom post types require a custom archive but creating a specific template file means it wouldn't work with every theme. The closest alternative I can think of that hasn't been mentioned above is to read the archive/index.php file on plugin activation ...


1

There are numerous storage mechanisms in WordPress, issue mostly is you might not be making right calls which one to use until you get some practical experience with them. Very loosely they are (from more user–facing to more developer–facing): posts/page and custom posts types — for post–like content widgets and sidebars they are going in — for “blocks” ...


1

All sorted. For any one interested, I simply added in a function (into functions.php) that redirected to my new template dependent on the name of the post (you could also use the ID). add_filter('template_include', 'new_template'); function new_template($template){ global $post; if($post->post_name == 'mortgage'){ $template = ...


1

In your wp-content/themes/your-theme folder you need create your own page template... CUSTOM PAGE TEMPLATE In the same folder where you just created your new file, you should see a file named page.php. Open that file by choosing to edit it, and then copy everything you find inside of it. Then, at the very top of the page, you will need to place some code ...


0

As you are on, 'single-press.php' , this is single 'press' post type page. As per your question, it seems you want to display archive of all 'press' posts, along with current posts highlighted. As we are on single 'press' post page, no need to check for post type. We can directly add following loop with modification in structure, as per your need, global ...


0

There are two things you need to keep in mind. In WordPress you have taxonomies and terms. For instance Category is a taxonomy, and let's say Portfolio is a term belonging to the "Category" taxonomy. What the code you just posted does is to take all the terms of the "faq_category_1" taxonomy and print all those values as a menu at the top. Then it makes ...


0

What you describe is called a Post Type Archive and it comes baked in with WordPress. It should show up on your site at example.com/press, assuming that you haven't give it a different slug with the rewrite arg of on your register_post_type() function for the post type. At that address, the query is automatically going to be showing all posts of the type ...


0

You can get by post page id if (has_post_thumbnail($page_id) ): $image = wp_get_attachment_image_src( get_post_thumbnail_id($page_id), 'page-post-thumbnail' ); endif; $image_URI = $image[0]; echo $image_URI inside image src.


0

Ok, so it turns out this was simply a case of going to Settings > Permalinks and merely saving. This reset the permalink structures.



Top 50 recent answers are included