Articles of posts

How do I edit the WordPress post.php file?

I have a Custom Post Type which contain a Gravity Form on my website. I would like to display a message on the back end of the Post when logged in as admin. The message will say when the form has reached its entry submission limit. The file that displays the post content in the […]

How I can made a custom post type to page templates?

In my site, I created a custom post type called: “Pictures” add_action( ‘init’, ‘create_post_type’ ); function create_post_type() { register_post_type( ‘Pictures’, array( ‘labels’ => array( ‘name’ => __( ‘Pictures’ ), ‘singular_name’ => __( ‘Pictures’ ) ), ‘public’ => true, ‘has_archive’ => true, ) ); } In my site, I want to have two pages: Index and […]

WordPress Count posts within a custom post type

How to WordPress count post within this code. <?php query_posts(‘showposts=6’); ?> <?php $posts = get_posts(‘numberposts=6&offset=0’); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == “6”) { break; } else { ?> <div class=”col-md-4 com-xs-12 pannel”> <div class=”pannel-news”> <?php the_post_thumbnail(); ?> <div class=”sidebar-color”> <strong><a href=”<?php the_permalink(); ?>”><?php the_title( ‘<h4>’, ‘</h4>’ […]

Update if post with specific title exists

I am trying to create a post, if it does not exist and update the post by its title if it exists. The title is unique, because its the users username. However, the update functionality does not work. A new post gets created all the time. The following code creates and should update the post: […]

Bootsrap carousel for post

I’m trying to have a Bootsrap carousel to display my post – They are being display, However, it doesn’t work correctly. It doesn’t slide basically…. Here is the live example: I’m using the code below: <div id=”myCarousel” class=”carousel slide”> <!– Carousel items –> <div class=”carousel-inner”> <?php $my_query = new WP_Query(‘posts_per_page=5’); while ($my_query->have_posts()) : $my_query->the_post(); […]

Detecting current page from class method

I’ve tried to look for a specific answer/tutorial on this subject but I’m coming up short and wanted to see what the SE community could suggest. At this point, any guidance whatsoever would be most appreciated. Basically I’m trying to determine the current page being viewed within a class method I’m setting up, but I […]

separate the post of a category by subcategory

I’m dynamically generating my category post by getting the Page title and match it with the category name. The category I’m posting sometimes has a subcategory now I need to separate this subcategory by groups. I’m using this code. <ul> <?php global $post; $post_slug = get_the_title(); $args = array ( ‘category_name’ => $post_slug, ‘posts_per_page’ => […]

WordPress display posts category in loop

I am working on a WordPress theme and this is my code to display posts. However I’m struggling to display all categories for a post. Most solutions don’t work for me but do for others. That’s also the reason why I post my full code on here because this code may not be the best […]

Show posts by quarter

How would I list an author’s WordPress posts by quarter in author.php? Current relevant author.php code is as follows (post is custom type “press mentions”, FYI). This presents a single list of all this author’s posts. But how do I break this list up in to segments, with quarterly headers, ie. “2015 Q3”, “2015 Q4″, […]

Post Title to featured Image ALT

i saw a interesting post on Stackoverflow where someone showed a code to to use the post title als alt tag for the featured post. So i tried to use the code for myself and change it a bit because mine differs a bit. Original Code $title=get_the_title(); the_post_thumbnail( array(150, 150),array( ‘alt’ =>$title) ); I changed […]