Tag Info

Hot answers tagged

5

If this is how it looks: <img class="alignleft size-medium wp-image-8530" alt="..." src="#" width="413" height="275" /> <img class="alignleft size-medium wp-image-8529" alt="..." src="#" width="413" height="275" /> Then you have to put them together like this: <img class="alignleft size-medium wp-image-8530" alt="..." src="#" width="413" ...


3

Yes of course. One of the ways to achieve this is by adding an extra category to your posts which you call 'sticky' or 'important' or something like that. For the example I will choose 'important'. To only get the important posts you can write a loop which loops through this category. For example: <?php $args = array( //arguments for the loop ...


2

Use below code for getting post format, simple made condition if post format ="standard" then load your preferred template $format = get_post_format(); if($format ="video") { get_template_part( 'format', $format ); } Something like this.


2

Yes you can use wp_count_posts( $type, $perm ); function to count number of posts published For details please visit here


2

There are a few errors which I want to address First of all, you should never use query_posts to construct custom queries. This is not just my emphasis, but the codex as well. The one big problem with query_posts is, it many circumstances, pagination fails Note: This function isn't meant to be used by plugins or themes. As explained later, there are ...


2

You should have to look at what the codex says about previous_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) and next_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) Both have the same parameters, the first parameter $format is the important one to have ...


2

This won't work if page caching is enabled, I would recommend creating an ajax request which calls this function instead. e.g. add_action( "wp_ajax_nopriv_view_count", 'view_count' ); add_action( "wp_ajax_view_count", 'view_count' ); function view_count(){ update_post_meta($_GET['id'], 'view_count', $count++); } (then create an ajax call in JS ...


2

First, before you start, just reflush your permalinks. It is sometimes strange why the Template Hierarchy fails. You code checks out, and should in theory work. Everything checks out, and to make sure, I tested it on my side. You can use this work around to "force" wordpress to use a template. Here we would use template_include filter hook. <?php ...


2

OK I got it working. Not sure if it is the best way but I thought I would add a reply anyway. Set up the information needed for the custom loop using $args = array As described in http://codex.wordpress.org/Class_Reference/WP_Query $args = array( 'post_type' => 'product', 'meta_key' => 'wpcf-topic', 'orderby' => 'meta_value', ...


2

Your problem lies in this line of code in your first piece of code 'category' => $term->name, There are two problems here, first of all, category is not a valid parameter for WP_Query, you should use category_name, as you are working with get_terms. get_terms does not return the ID like get_categories, which is an alternative for the first part of ...


1

We can not hook wpautop() function. Because then it will trim all the paragraph and break tags from the content. After inserting the image in the editor just click on "Text" tab on the top right corner of the editor and remove the paragraph and break tags that comes in between images. For more options(like alignment and other attributes) click on the ...


1

In terms of the query, it's pretty straightforward to do this, but you'll have to come up with your own interface for creating the order of posts, which should ultimately save the post IDs to an array in the order you want them to appear: $post_ids = array( 42, 13, 23, 99 ); Then it's just a matter of getting a "page" of those IDs: // current page number ...


1

WordPress galleries are implemented as shortcodes: the [gallery] shortcode should appear in the post_content of your "basic" post (whose post_type = 'post'). The shortcode's parameters specify the images to be included in the gallery by giving the post ID of the attachment-type post containing each image. So if you see two posts in wp_posts like this: id | ...


1

These additional dropdowns are added via the restrict_manage_posts action hook. This means the dropdown output isn't filterable, but you can remove the hooked action from Yoast SEO. The filter dropdown is added by the posts_filter_dropdown() method in the WPSEO_Metabox class. It's added in the setup_page_analysis() method of the same class, which is hooked ...


1

Finally I got the solution. One of the major problems was the usage of "get_post_custom" for fetching the database. I used "get_post_meta" instead and it was a lot easier to work with the array that was created by that function. I am sure that it would have been possible to do it with the first function as wee but I do not really understand its ...


1

You can use the wp_insert_post() function to accomplish creating a new post, including it being in a draft state. As you can see in this snippet from the Codex, you can control all the aspects of the post, including post date, draft status, post type, categories, and much more. $post = array( 'ID' => [ <post id> ] // Are you ...


1

The filter responsible for adding these characters is wptexturize, you can remove it using remove_filter. remove_filter( 'the_content', 'wptexturize' ); remove_filter( 'the_excerpt', 'wptexturize' );


1

Add wp_reset_postdata() after your while loop: endwhile; wp_reset_postdata(); endif; This will ensure that, after your shortcode runs, the actual current post is restored, so that any template tags display the right data.


1

First of all, don't use query_posts; use a WP_Query object instead. The reason your links are not being displayed correctly is that the link (<a> tag) is not actually within the loop. <?php while ( have_posts() ) : the_post(); ?> <a class="heading-link" href="<?php the_permalink(); ?>"> <?php the_title(); ?> ...


1

Your search form includes this: <input type="hidden" name="post_type" value="postpage" /> So when your search page loads, the query variable 'post_type' is set to load posts of type 'postpage'. Since posts are of type 'post' and pages are of type 'page', neither of which are 'postpage', you do not get what you expected. Next time, don't use ...


1

This can be achieved by making use of Masonry a Cascading grid layout library Which is included in WordPress since 3.5 and has been updated to v3 with the release of version 3.9 of WP. It really is a nice tool to accomplish different kind of grid layouts. Of course it isn't necessary to use this library, but it is indeed really good for grid layouts, ...


1

Use wp_reset_query() to restore the original query. This also calls wp_reset_postdata, so you can just replace that.


1

There's a plugin which does this perfectly: http://wordpress.org/plugins/post-tags-and-categories-for-pages/


1

Two things are important here, your taxonomy is portfoliosets, which mean this is not a built-in category. videos and magazines are terms of your taxonomy. From what I can make from your question, you need to show different header image for different single post page view depending on the term a post belongs to. Based on this, you can use the has_term( ...


1

You are correct that it is the <br> tags, but there is an alternative: Place each image in their own paragraph, not adjacent lines This is how line breaking works in WordPress content: Paragraphs This is paragraph 1 This is paragraph 2 Short line breaks This is paragraph 1 This is also paragraph 1 but on a new line without a space So don't ...


1

Something along the lines of: $args = array( 'posts_per_page' => 10, 'post_type' => 'post', 'meta_key' => 'METAkeyNAME', //what I assume you've called a meta box 'meta_value' => 'THEdesiredVALUE', 'orderby' => 'ID', //choose to order by anything look here ...


1

The quick fix is to wrap your image tags in div tags. That will prevent WP from wrapping the images in P tags. Then, you could give the divs a class for further control of appearance/arrangement.


1

You don't have to create any dummy page for custom post types, as those archive pages are just an automated process and named using the post type object name. To make sure your Custom Registered Post Type uses/support archive page, set the parameter 'has_archive' => 'documents' for Document & 'has_archive' => 'videos' for Video. ...


1

Ok, so this is how I did it. This hook into the admin head, find the screen options part and set the default checked radio button to 1, which mean full screen. Just found the answer from here and give it a little modification: add_action( 'admin_head', 'wpse1152474_post_editor_columns'); function wpse1152474_post_editor_columns() { ...


1

As Pages are a special built in Posttype, they get an own template hierarchy. Other "normal" post types and custom post types can only be templated by "single-$posttype.php". You can however hook into the single_template filter and make wordpress redirect to your template file: function get_custom_post_type_template($single_template) { global $post; ...



Only top voted, non community-wiki answers of a minimum length are eligible