Tag Info

New answers tagged

0

you did not describe what you edited to add the isotope filtering, but you seem to have removed post_class() from this line to add your isotope class: <article class="<?php echo $termsString; ?>item"> change it to: <article <?php post_class( $termstring . 'item' ); ?>"> http://codex.wordpress.org/Function_Reference/post_class


0

get_pages returns an array of post objects, so you would use foreach to iterate over each object and grab the ID and whatever else you want to use: <?php if ( $pages = get_pages( $args ) { echo "<select multiple>"; foreach ( $pages as $page ) { echo "<option value='{$page->ID}'>{$page->post_title}</option>"; } ...


0

Have you thought about something as simple as an <iframe> -- If the information on the target page remains static you can just point the iframe to target that page. There's an example on how to do this here: http://www.dimpost.com/2012/12/iframe-how-to-display-specific-part-of.html (in case of broken link) <div style="border: 3px solid rgb(201, ...


0

You can try using the JSON API plugin. It has endpoints for latest posts etc that can be accessed via jQuery, I use it to power mobile apps that use WordPress for content management. You also have the ability to create your own endpoints if the defaults don't give you what you need. Good luck!


0

As @Romain mentioned, you should see what get_post_type() returns. Basically it will return a string representing the post type - i.e 'post' or a boolean (False) if there was a failure. But back to question about conditionals... Conditionals in WP can be tricky especially in templates because you are switching in and out of HTML and it can really make it ...


0

When you are coding, you always need to review information that wordpress functions are returning you. It will help you debug your project. By the way, here you can find all information about the get_post_type function Code: <?php $current-post-type = get_post_type( get_the_ID()); var_dump("current-post-type value: "+$current-post-type); ?> Then ...


0

You can use XML-RPC which is supported by Wordpress. You can use RSS if you just want to read the latest posts and it will be easiest to implemented. Both solution needs PHP so a static HTML Website won't be possible. But yes you will not have a CMS and it will be standalone. More here : http://codex.wordpress.org/XML-RPC_WordPress_API ...


0

Here you go: // Returns the attachment ID uploaded $attach_id = omakUploadImage( $file, $post_id ); // Set an image as Featured Image to post with $post_id // This is the cream you needed, Nivos set_post_thumbnail( $post_id, $attach_id ); // omakUploadImage is a custom function which takes an input type="file" value function omakUploadImage( $file, ...


0

I am not sure this answers your question directly, but as technical trivia — WordPress actually creates a posts as soon as you open editor, with auto-draft status. This is being used precisely to have a target for things like attachments and custom field before it is actually saved by user. So when user "saves" the post for the first times it's not actually ...


0

I see you are on WP.com blog. .home .attachment-pictorico-home.wp-post-image { height: 100%; width: 100%; } This small CSS code can fix your issue. But, I think(I am not sure) you will need to buy some add-on to edit styles on a WP.COM blog. If you can edit styles, just paste it in the end of your stylesheet file, and you will have your pics on ...


0

This should not be do difficult to achieve. What I would suggest is to create yourself a child theme. It is quick and very easy. The reason for this is, never make changes to a theme/plugin that you are not the author of. Once you have your child theme up and running, copy the page.php template from the parent theme to your child theme and rename it ...


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 ...


0

Use add_action( 'save_post', 'shortend', 999); and put this in your function as first. if ( 'project' != $_POST['post_type'] ) return $post_id; If this doesn't work then you should echo $_POST; and see if kaart_verkoop is part of the array.


1

<?php $args = array( 'posts_per_page' => 5, 'cat' => 2, 'tag__not_in' => array(5), // Assuming 5 is the ID for the tag 'order' => 'asc' ); $query = new WP_Query($args); while ($query->have_posts()) : $query->the_post(); ... endwhile; // don't forget to reset/restore the query wp_reset_postdata(); ?> make sure that ...


-1

Solved by myselfe using: <? // get the term using the slug and the tag taxonomy $term = get_term_by( 'slug', 'featured', 'post_tag' ); // pass the term_id to tag__not_in query_posts( array( 'tag__not_in' => array ( $term->term_id ))); ?>


0

The URL you are trying to pass to cannot be used (wp-content/themes/stargazer/populate.php) As @Milo pointed out, please check the AJAX Codex, and it will explain the use of 'ajaxurl', which is a protected variable. In short, all AJAX requests must be passed through 'admin-ajax.php' whether it is for the frontend or backend.


1

I think if you want to show recent posts posted 2-3 days ago, you can use date queries, provided by WordPress You can get more information about date queries from here: WordPress Date Queries For Example: If you want to show last three days posts, it can be done using the following snippet of code: //set the arguments $args = array( 'order' => ...


1

This quite an opinionated question as there are many methods which you can use to reach your end goal. There are a couple of questions you should ask yourself here first, like, do I need these posts to be part of my normal blog posts, what are these posts intended for, how often will I rotate them, or will they stay for a long length of time. Based on the ...


0

1.Download super post plugin 2.Go to Dashboard>Appearence>Widgets 3.Select the Super Post widget and drag it to sidebar 4.Expand Super post set IMPORTANT as title and select the type of post you want in it, the options are: Recent, most commented, sticky, related, Taxonomy: category or tags. 5.Choose category or tags, link the post that are important to ...


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 ...


0

As already stated, this functionality is not natively supported by Wordpress, but that does not say it can't be done. To accomplish this, you'll need to add a custom query_vars, and add custom sql queries and joining these queries through the posts_join posts_orderby filters. This code was stripped from the Filter By Comments plugin from Kevin Ingersoll. ...


1

You can try this plugin http://wedevs.com/plugin/wp-user-frontend-pro/ Had some projects with this on board. Really cool thing. Where is a guest and registered users posting ability. I think you can add register form somewhere along article inputs.


0

What about using this function in functions.php: function new_excerpt_length($length) { return 20; } add_filter('excerpt_length', 'new_excerpt_length'); And then getting it by adding<?php the_excerpt()?> to php template? OR: <?php $string = get_the_excerpt(); if (strlen($string) <=20) {echo '' . $string . '';} else {echo '' . ...


2

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


0

"The Loop" is already a loop, so I don't see the need for your second loop. In fact, the secondary while loop shouldn't work because you keep resetting it to 1 for every post. You also have some PHP syntax issues like $echo (that's a variable) instead of echo and the way you concatenate the number variable with the "slide-" string. The following [untested ...


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( ...


0

You can change the post_modified_date of the post on a new comment using this code add_action( 'wp_insert_comment', 'update_post_modified_date', 10, 2 ); function update_post_modified_date( $comment_id, $comment ) { wp_update_post( array( 'ID' => $comment->comment_post_ID ) ); } Then while querying posts use modified as orderby parameter


0

I think portfoliosets is custom taxonomy and videos and magazines are terms. So your code should be like $post_terms = wp_get_post_terms( get_the_ID(), 'portfoliosets', array( 'fields' => 'slug' ) ); if( in_array( 'videos', $post_terms ) ) { echo ' <style type="text/css"> .page_header { background: url("mysite/image.jpg") ...


0

WordPress post queries don't natively support ordering by such specific comment information, only by comment count. Rest of comment-related things aren't stored in posts table and not available for easy querying. While it's probably possible to cook up SQL for this, I think it would be more practical to store date of comment in its parent post's custom ...


1

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


0

Use the WP_Query, there have a param for the author, like the follow example, that give you all posts to user with the ID 1. $query = new WP_Query( array( 'author' => 1, 'post_status' => 'publish', 'posts_per_page' => -1, 'showposts' => -1, 'nopaging' => true ) ); The result can you use in a loop, ...


0

WordPress queries (using WP_Query or get_posts() either) support post__in argument to retrieve specific set of posts by IDs. So you would need to produce such list from your custom storage and then use in a query.


0

You have double posted this question, and in your comment in the previous question you said that you don't know if you are using build-in categories or custom taxonomies. Essentially, built-in categories and custom taxonomies are both Taxonomies, and the "categories" that you create in the back end are in actual fact just terms of the taxonomy 'category', ...


0

This is personal preference, but I don't really like using $wp_query and complicating things. There are two ways to solve this problem, one, by using a temp variable with $wp_query and two, changing the name of your variable and fixing pagination, which I would recommend, again, personal preference METHOD 1 As I said, you can assign a temp variable to ...


1

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


0

Your code was really helpful for me, but the "sticky post" option is still showing on the quick edit at the "All posts" page, so I've made some changes to fix this: // Hide sticky posts add_action( 'admin_print_styles', 'hide_sticky_option' ); function hide_sticky_option() { global $post_type, $pagenow; if( 'post.php' != $pagenow && 'post-new.php' ...


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

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 ...


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 ...


0

<form action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="post"> <input type="submit" name="user_info_form" id="user_info_form" /> </form> I think there is a syntax error in the PHP. It should end with a semicolon, like this: <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post"> <input type="submit" ...


0

Assuming the issue is the <br> tag (which I believe is correct) and based on one of your comments indicating that you do not wish to go back and edit the posts, you could use the the_content filter to look for instances of two medium-sized images separated only by a new line (which is being replaced by a <br> tag as part of WordPress' wpautop() ...


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 ...


1

rearrange your code and use post_count; example: <?php $movieNumber = 1; $today = date('Ymd'); $posts = array ( 'post_type' => 'movie', 'posts_per_page' => -1, ); $loop = new WP_Query( $posts ); ?> <div id="posters<?php echo $loop->post_count; ?>"> ...


0

Simply declare a variable above like $i=0; and use $i++ in while loop echo $i; where you want to show number of posts displaying. may it will work


0

You can use the transition_post_status action to manipulate the post content at the time when it is published. You just need to add a function like the one below into your theme or plugin: function post_published( $new_status, $old_status, $post ) { if ( $new_status == 'publish' && $old_status != $new_status) { //Do whatever you want to ...


0

You could try using jQuery to remove them for you: jQuery(document).ready(function($){ $('img').next('br').remove(); }); This should remove any br tags after images as next will select the immediate next element. If that gives you issues you can try .nextAll('br:first') instead See here for more examples and things you can try.


0

Before your you have to create a new query then count the results: global $wpdb; $count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type='movie'"); <div id="posters<?php echo $count; ?>">


0

You might use $_SERVER['HTTP_REFERER'] but take in mind that is not always sent so check for its existence and think about a fallback!


0

Wordpress usually adds the category as a class in the body/article tag of each page, you can probably style each category with a custom background through that class.


1

I do not know this theme. But you must use this two functions somewhere: get_theme_mod ('background_image', $default); set_theme_mod ('background_image', $_category_image_absolute_path); Maybe, you can define new modification names with this functions. For example, 'backgroud_image_entertainment', 'background_image_storysode', etc. (as is shown in the ...



Top 50 recent answers are included