Articles of blog

How to create Blog Post Specific Widget

I want to create widgets which will display based on post. I have considered the option of creating a widget post type using Advanced custom post type plugin and populate this widget while writing post. What I want to understand is, is there any out of box functionality available which can be achieved easily. Or […]

What is archive.php used for?

Dumb Questions Ahead: If index.php and archive.php are practically the same thing, what’s the point of having archive.php? When should I ever want to use archive.php over index.php? If I use front-page and Blog, it doesn’t switch to archive.php which you might expect to and then use index.php in the place of front-page.php.

index.php template is used instead of blog page

I am trying to set WordPress so that home page is static, and the blog page is a separate page. So, I created two page templates in my theme., lets call them home_template and blog_template. Then, I created two WordPress pages (from Pages -> Add New). The first page is called Home, and is using […]

How to show a full post, not just an excerpt

I have a blog page where blog posts have an excerpt on with a continue reading link below. When the link is clicked the full post should appear/or should be diverted to. This isn’t that case. The user is diverted to the post, however only the excerpt is displayed along with a continue reading link […]

A function to fetch blog content via rss feed

I am trying to make a function which take an rss fedd URL and fetches the most recent 2 posts. I have tried to remake the snippet from here to a full function in funtions.php as following. I don’t want to use a plugin for this since the plugins I have looked at have been […]

Display sidebar if blog

I have two sidebars registered. One called Sidebar (sidebar-1) and the other called Blog Sidebar (sidebar-2). I would like to display the Blog sidebar on the blog index and single posts. As WordPress doesn’t have a conditional tag for the blog page, I have tried the following via sidebar.php: <?php if ( is_front_page() && is_home() […]

How to post twitter like updates on wordpress

Is there a plugin or a hack such that I can make short updates similar to twitter’s on my own wordpress blog? Perhaps making use of a custom post type or something on those lines? What i’m trying to achieve is to create short (150 character limit) posts different to the regular posts on the […]

is_singular() not working if called via callback function of admin-ajax.php

In my single.php I’ve some code like this … if(is_singular(‘post’)) { echo ‘Blog’; } else { echo ‘CPT’; } If I approach single.php from blog or CPT index page by using the_permalink(), this condition works correctly. It show ‘Blog’ when I open single blog post and shows ‘CPT’ when I open single CPT. Now the […]

WP_Query doesn't get sticky post at the top, when used in a page template

I’m creating a theme in which I’ve created a page template called page_default-blog.php to be used for creating a blog page. In this file I have the following code: $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; $args = array( ‘paged’ => $paged, ); $custom_query = new WP_Query($args); if ($custom_query->have_posts()) : while($custom_query->have_posts()) : $custom_query->the_post(); ?> the_title(); […]

Make Search Function include subdomain (blog.ourwebsite.com)

Wondering if there’s a way to edit our search.php or .htaccess or function.php (or anything else…) so that our search function on our main site (www.oursite.com) includes the subdomain of blog.ourwebsite.com? Any thoughts or suggestions are appreciated it..