Articles of posts

Add multiple meta keys to a post at once

I figured how to add an input value as a meta key value to a new post from a frontend post form (thanks to @thedeadmedic), but I can’t figure how to add two or more meta keys at once. Is this possible with the next code? These meta keys are named ‘location2’ and ‘price’, and […]

How to display all posts assigned to some tag?

I have tag url – and I have 2 posts tagged with those keywords new-shoes. I would like to display on this url all posts (titles and first keywords from posts) tagged with new-shoes. I have a problem, because url shows me exactly the same page like main page of my website. […]

Change url-structure for wordpress pages – pages in strucutre not top-level

I use wordpress as a cms in which i use a some wordpress pages for standard content and posts for a wordpress blog. Now ive got a problem that the pages should not always be on the top level url and that i can set the url of these pages according to the menu i […]

Is there a way getting post fields using `transition_post_status`

First I tried fetching post_meta data, and latest, I tried fetching get_post_field() inside a transition_post_status hooked function, like: <?php add_action( ‘transition_post_status’, ‘yes_send_email_notification’, 10, 3 ); function yes_send_email_notification( $new_status, $old_status, $post ) { if( ‘mycpt’ === $post->post_type && ‘new’ === $old_status && ‘pending’ === $new_status ) : $post_id = $post->ID; /** * Generate Dynamic values */ […]

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