How to increase excerpt length in wordpress? [duplicate]

function custom_excerpt_length( $length ) { return 20; } add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 ); Add above code to your functions.php, and set the value 999 to the desired length. Source: the_excerpt() — Codex

How to create shortcode of this PHP code

This should do it.. function future_posts_function($atts){ extract(shortcode_atts(array( ‘poststatus’ => ‘future’, ‘order’ => ‘DESC’, ‘showposts’ => 10, ), $atts)); $return_string = ‘<ul>’; query_posts(array(‘post_status’ => $poststatus, ‘order’ => $order, ‘showposts’ => $showposts)); if (have_posts()) : while (have_posts()) : the_post(); $return_string .= ‘<li>’.get_the_title().'</li>’; endwhile; endif; $return_string .= ‘</ul>’; wp_reset_query(); return $return_string; } add_shortcode(‘future_posts’, ‘future_posts_function’);

How can I fix my pagination?

You need to add the paged parameter to your WPQuery: $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; $query = new WP_Query( array( ‘posts_per_page’ => 5, ‘paged’ => $paged ) ); Here are the docs.

Adding a script & php to functions.php

First you should include this code in your footer.php – or similar. Second: if ( is_product() ) { //you are already in php function add_klaviyo_script() { echo ‘<?php // dont need to echo php $ItemId = $product->id; // and variables The solution(footer.php): <footer> …things </footer> <?php if ( is_product() ) { $ImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id( … Read more

$_html is empty when var dumped

so I turn to you guys to help me see what I am doing wrong here. First thing your doing wrong is over complicating a simple effective API. Your code makes no sense. Your mixing functions that echo output with arbitrary html mark up that gets assigned to a non existing class property that nothing … Read more

Retrieve Array from within Array [closed]

It looks like you are using Advanced Custom Fields. Your “Product ID” is storing the object, instead of just the ID. Below shows you how you can access the post ID, otherwise just change your field saving option for Product ID. It’s a simple foreach statement. foreach( $pages as $page ) { echo $page[‘product_id’]->ID; }