How can I put two variables in post__not_in like this: When I do this only posts from first variable don’t show up from the others show up. I can do that with array push like below but is there any different way to do it? Answer According to the wp_queryDocs, post__not_in accepts an array of post ids. It’s not clear
Tag: custom-wordpress-pages
Issues when using WordPress rewrite rules then accessing parameter using get_query_var
I’m developing a WP plugin and have a WordPress URL: (e.g.: http://localhost/testsite1/coder/?id=66), and have attempted to add a rewrite rule to http://localhost/testsite1/coder/66/ using the following rule: I have registered a WP Query Var using: but when at URL http://localhost/testsite1/coder/66/, when I run code echo get_query_var(‘id’); nothing is displayed however when at URL http://localhost/testsite1/coder/?id=66 the echo statement will display 66. What
WordPress two custom_post_type one taxonomy
I create two custom post_type. The name of the custom post is- 1. Brand 2. Ethical And I have created a taxonomy. The name of the taxonomy is – Pharma. The common taxonomy of the two custom posts is one (pharma). Now I want, on one page – 1. Just to display all the names of Pharma Taxonomy. 2. I
WordPress additional info
That’s what my post looks like at the moment: I have the title ( David Art ) and the content (image + 1.25 eth). I as well have featured image: When I’m trying to get the title and featured image it works ok. But there are problems with content since I`m only able to get it together using the_content();. Is
WordPress how to get a single post link
I want to go to single.php file when this button is clicked. but it doesn’t do anything. Answer Replace this: with this: And then style your a tag like a button.
WordPress how to check if a query has posts
This code allows me to display to the connected user the list of his written articles. However, I would like to choose the message that appears when no articles have been written (when the list is empty). I know that I need an IF statement but I don’t really know where to put it and with which data. I would
WordPress how to display all posts based on tags
I have 3 tags: Tag 1 Tag 2 Tag 3 I need to display all of the posts in my custom post type and specified term. They need to be sorted by tag and hiding the tags that are not being used like this: Tag 1 Post A Post C Tag 2 Post B But it’s displaying like this: Tag
WordPress how to display user_meta array as a table?
I have tried posting this on Wordpress stackoverflow, but haven’t got any answers. This is PHP + Wordpress question, so maybe someone here could help. Ok, so I’m building a “Transactions” table for a user using user_meta array. I’m new to this and trying to figure things out. Basically, in practice I know how to store array to user_meta. My
WordPress how to get the post thumbnail inside a figure tag
I am running a query loop and want that ‘if’ the post has a featured image, it needs to be inside a <figure> tag. But the featured image’s <img> tag is appearing before the <figure> tag. What could be the reason? The problem can be better understood with this image: Answer It’s because you’re using the_post_thumbnail function which echo the
WordPress how to show all posts in the index page and exclude sticky posts
Since Wordpress sticky posts feature allow the post checked as sticky in post publish panel to be placed at the top of the front page of posts. I want to show all posts in index without sticky posts: Answer You could use pre_get_posts action hook to manipulate the query. Since you need to modify the query on your index.php, the