latest posts shortcode with image

Image fix You are using the incorrect function to return the image source url. Change the_post_thumbnail_url( $post[“ID”] ) to get_the_post_thumbnail_url( $post[“ID”] ) see https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/ To fix the echo Use a $return variable like so: $out=”<div class=”recent-posts”>”; $out .= ‘<h1>’.$content.'</h1>’; foreach($recent_posts as $post){ $out .= ‘<div class=”updated”><p>’ . $post[‘post_title’] . ‘.<a href=”‘ . get_permalink($post[‘ID’]) . ‘”>’; … Read more

Load next post by ID on a single page

It seems that I found a solution to this and it is pretty easy. So I’m gonna post all the code for future uses: single.php <?php get_header(); ?> <?php $post = get_post(); $post_cat = get_the_category($post); $data = collection_data_json($post_cat[0]->term_id, $post->ID); $data_details = collection_order_permalink($data); $author_id = intval($post->post_author); ?> <script type=”text/javascript”> var cat = “<?php print $post_cat_id ?>”; … Read more

Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?

I played around with the plugin files and was able to figure it out myself. For anyone who’s wondering, you can use wp_insert_post. You just need to find what variable the generated shortcode is stored in, which can take a little digging through the plugin files. For the plugin I was working with, it went … Read more

Add custom shortcodes to the Welcome Mail

Based on your updated question and comments, this should be what you are looking for: function wpse_225078_wpbd_tags( $tags ) { $tags[‘one_time_link’] = one_time_link(); return $tags; } add_filter( ‘wpbe_tags’, ‘wpse_225078_wpbd_tags’ ); The idea is to hook into the tag system provided by WPBE so you can just use %one_time_link% in your email template. Please note that … Read more

function of parent not working in childtheme

For inherited parent theme you need to add Template lines in child theme. Please read this https://codex.wordpress.org/Child_Themes /* Theme Name: Twenty Fifteen Child Theme URI: http://example.com/twenty-fifteen-child/ Description: Twenty Fifteen Child Theme Author: John Doe Author URI: http://example.com Template: twentyfifteen Version: 1.0.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: light, dark, … Read more

Is Post-Author-Id shortocde

This is pretty straightforward as far as shortcodes go: function wpse_226998_post_author( $atts, $text ) { if ( ! empty( $atts[‘id’] ) && $atts[‘id’] == get_the_author_meta( ‘ID’ ) ) return $text; } add_shortcode( ‘post_author’, ‘wpse_226998_post_author’ ); And in practice: [post_author id=”8″]This post is by author ID 8[/post_author]