Kiran
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Get wordpress Attachment PPT url in PostI am not a developer. But with your help I will try to do something myself.
Here is the overall code of post.php.
I want to show .ppt in all posts.I want to show .ppt file from ifrem. But the URL of the ppt file attached in the post is not available.
Hope you will solve it.
<?php if ( ! defined( 'ABSPATH' ) ) exit; function my_simple_crypt( $string, $action = 'e' ) { $secret_key = 'drivekey'; $secret_iv = 'google'; $output = false; $encrypt_method = "AES-256-CBC"; $key = hash( 'sha256', $secret_key ); $iv = substr( hash( 'sha256', $secret_iv ), 0, 16 ); if( $action == 'e' ) { $output = base64_encode( openssl_encrypt( $string, $encrypt_method, $key, 0, $iv ) ); }else if( $action == 'd' ){ $output = openssl_decrypt( base64_decode( $string ), $encrypt_method, $key, 0, $iv ); } return $output; } function remove_wp_block_file_div($content) { $content = preg_replace('/<div class="wp-block-file">.*?<\/div>/s', '', $content); return $content; } add_filter('the_content', 'remove_wp_block_file_div'); get_header(); ?> <?php $args = array( 'post_type' => 'attachment', // Retrieve attachments 'post_mime_type' => 'application/vnd.ms-powerpoint', // Filter by MIME type for PPT files 'posts_per_page' => -1, // Retrieve all attachments ); $attachments = new WP_Query($args); $attachment_url = wp_get_attachment_url($attachment_id); if ($attachments->have_posts()) : while ($attachments->have_posts()) : $attachments->the_post(); $attachment_id = get_the_ID(); $attachment_title = get_the_title(); $attachment_url = wp_get_attachment_url($attachment_id); endwhile; endif; wp_reset_postdata(); // Restore the original post data ?>` <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="content ringtone" data-id="<?php echo get_the_ID(); ?>" data-value="<?php echo $URLs_Link_MP3 ; ?>"> <div class="row"> <div class="col-md-12"> <h1><?php the_title(); ?> PPT</h1> </div> </div> <div class="row"> <?php $attachment_url = wp_get_attachment_url($attachment_id); ?> <iframe src="https://view.officeapps.live.com/op/embed.aspx?src=<?php echo $attachment_url; ?>" width="100%" height="500" frameborder="0"></iframe> </div> <?php get_footer();
Forum: Developing with WordPress
In reply to: Get wordpress Attachment PPT url in PostI tried all but ppt url is not loading in the frame.
Forum: Developing with WordPress
In reply to: Get wordpress Attachment PPT url in PostThe output requires the URL of the PPT.
check Our Test Page : https://pdfseva.org/2023/10/22/cold-chain-system/
Forum: Plugins
In reply to: [Favorites] Error -Cannot use a scalar value as an arrayHere we have mentioned the error code to explain the question in detail. In which the problem is coming. ( We have given the code from line 65 to 74 here. )
{ foreach ( $this->formatted_favorites as $site => $site_favorites ){ // Make older posts compatible with new name if ( !isset($site_favorites['posts']) ) { $site_favorites['posts'] = $site_favorites['site_favorites']; unset($this->formatted_favorites[$site]['site_favorites']); } foreach ( $site_favorites['posts'] as $key => $favorite ){ unset($this->formatted_favorites[$site]['posts'][$key]); $this->formatted_favorites[$site]['posts'][$favorite]['post_id'] = $favorite; }
Forum: Fixing WordPress
In reply to: I am facing problem in loading and downloading Mp3 filesI destroyed the cache in cloudflare and re-configure the setup and the problem was solved.
Forum: Fixing WordPress
In reply to: I am facing problem in loading and downloading Mp3 filesBut other website is in same server – same cpanel there is no problem in it.
Forum: Fixing WordPress
In reply to: Show Related posts loop based on tagsWorking ….. I put this code and it is working successfully.
// Get the current post's tags $tags = wp_get_post_tags( $post->ID ); $tagIDs = array(); if ( $tags ) { // Fill an array with the current post's tag ids $tagcount = count( $tags ); for ( $i = 0; $i < $tagcount; $i++ ) { $tagIDs[$i] = $tags[$i]->term_id; } // Query options, the magic is with 'tag__in' $args = array( 'tag__in' => $tagIDs, 'post__not_in' => array( $post->ID ), 'showposts'=> 5 ); $my_query = new WP_Query( $args );
Forum: Fixing WordPress
In reply to: Show Related posts loop based on tagsI have prepared this related post loop. But is not working. Can you give any suggestion on this?
function rtones_related_post() { ?> <?php global $wpdb, $post, $opt_themes; $tags = get_post_tags($post->ID); $numbers = $opt_themes['ex_themes_related_posts_numbers_']; if ($tags) { $tag_ids = array(); foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; $args=array( //'tag' => $tags->slug, 'post_type' => 'post', 'post_status' => 'publish', 'orderby' => 'rand', 'post__not_in' => array($post->ID), 'posts_per_page'=> $numbers, 'caller_get_posts'=> 1 ); $my_query = new WP_Query( $args ); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php get_template_part('template/loop.home'); ?> <?php endwhile; } echo ''; wp_reset_query(); }?> <?php }
Forum: Fixing WordPress
In reply to: Show Related posts loop based on tagsYes, saw it, but it’s not working. Somebody help me please.
Forum: Fixing WordPress
In reply to: View the PDF file Size In PostOh… Very good. Been trying since two days. Its Working Fine. Thanks @threadi