Right now I am using: $wp_query->post->ID; I want to know if there is a better way for getting the post id that consumes less resources?
Trying to solve this issue for the past hour and I can’t figure out what’s going on. Trying to create single-blog.php (I have a few posts which are under the category ‘blog’) but WordPress automatically redirects these posts to single.php! I’ve flushed the permalinks by settings > permalink > save changes but still nothing happens. […]
I’m showing posts of the term ‘football’ belonging to the taxonomy ‘section’, and everything works perfectly but Where can I specify the number of posts I want to show? just like this: ‘showposts’ => 3 I do not know where to put it $myquery[‘tax_query’] = array( array( ‘taxonomy’ => ‘section’, ‘terms’ => array(‘futbol’), ‘field’ => […]
As it is now, when I trash a post, the related comments get deleted at once. Is this standard? Instead I’d like them to be moved to the trash bin, when I trash the post. How can I achieve this? I can’t seem to find a solution.
I’m having issues with setup_postdata(). From my understanding, if I want to use functions such as the_permalink() or the_title(), I must use setup_postdata(). Right now, the_permalink() or the_title() is returning nothing (blank). I’ve also tried echo get_the_title() to see what happens but even that yields the same result. Here is the code the relates to […]
I have a custom post type where I can create pages in.(“article.php”) It automatically uses the template “single.php” when I create a page, although I want to change some things in it without effecting some other pages on the website. I tried making a single-article.php file, but it is still using the single.php template page. […]
I’m trying to get my news page to display content from one category only (number 3) but I cant seem to get it to work. Instead of just displaying posts from category 3 it displays posts from all category’s. Here is my code: <?php get_header(); ?> <div class=”content news_page”> <h1>Latest News</h1> <?php $args = array( […]
I would like to include some text at the end of every post. Like how some people write “Like my posts? Follow me on twitter!” or something like that. There are some buttons for users to tweet or share the posts, but I want to see how people would respond to explicit suggestions. I thought […]
I am trying to write some code for a slider of posts, at the moment my code involves two WP_Querys, one inside the other, but I can’t help feeling there may be a more efficient way of doing what I’m trying to achieve. Steps are: Check how many published posts there are of a certain […]
I’m writing a custom post type as a plugin and trying to figure out how I can enable post thumbnails within plugin documentation/template instead of enabling it in the functions.php. I tried adding the code below inside custom-post-plugin.php and it doesn’t seem to work. I still have to write the code within the functions.php to […]