Insert PHP into wordpress page [duplicate]
This is a DUPLICATE! You will find the same question answered by me here.
This is a DUPLICATE! You will find the same question answered by me here.
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
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’);
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.
You probably deleted some files your hosting provider needs. I would reach out to them for assistance.
If you are looking for the ID of the every published page, then you need to query them all. To do so, write a simple query that grabs every page from database: $args = [ ‘post_type’ => ‘page’, ‘posts_per_page’ => -1 // Query all pages ]; $pages = new WP_Query( $args ); Now, run a … Read more
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
I think your method sounds solid and with custom, hand-designed websites your time frame is quite reasonable. We primarily use the Divi theme which is highly customizable and it still takes us few days to get from concept to launch. The vast majority of time is in the fine details and tweaks, and those are … Read more
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
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; }