Articles of posts

Archive Page for Custom Post Type is not Working

I have registered a custom post type “tutorials” with the following snippet. <?php /* Template Name: Tutorial Archive */ get_header(); ?> <div id="content"> <div class="archive-page"> <?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=8&post_type=tutorials'.'&paged='.$paged); if ($wp_query->have_posts()) : ?> <h1>Tutorials Archive</h1> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <article class="posts" id="post-<?php the_ID(); ?>"> <h2><a […]

Possible to create a permalink to sort with meta_key?

I feel like I’ve been all around the web and back again looking for an answer to this and it’s really starting to grind my gears. Not sure if this is the correct way to do it, but I want to add a query_posts array to a URL in the form of a query_arg. This […]

Is there a better, more efficient way to get the post id outside the loop?

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?

custom single.php not working

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. […]

Specify number of posts in my 'tax_query'

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’ => […]

When trashing a post, also trash related comments

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.

setup_postdata doesn`t seem ot be working

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 […]

Trying to edit the single page from a Custom Post

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. […]

Display content from a specific category

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( […]

Including text at the end of every post

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 […]