Forum Replies Created

Viewing 15 replies - 16 through 30 (of 105 total)
  • Thread Starter DJABHipHop

    (@pressthemes1)

    Thread Starter DJABHipHop

    (@pressthemes1)

    Thread Starter DJABHipHop

    (@pressthemes1)

    Thread Starter DJABHipHop

    (@pressthemes1)

    In a dev environment is is use of as i mattion a theme and want know, the size between the of and my copy

    Thread Starter DJABHipHop

    (@pressthemes1)

    @qriouslad no way to view the author archive as some put the author box author.php

    make that global no just ASE, also add it to the customizer as well

    Thread Starter DJABHipHop

    (@pressthemes1)

    I made the plugin back in 2017 to make the rss feed look nicer feel free to use parts of the code in ASE to make the rss feed look better.

    <?php
    /*
    Plugin Name: Pro Rss
    Plugin URI:
    Description: This plugin adds post thumb search Tag & Related Post to RSS Feed 1&2 .
    Version: 1.2
    Author: Press Themes & BAProdoction
    Author URI: Press Themes & BAProdoction
    License: GPL3
    */
    ?>
    <?php
    /*
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, orss code. A hook is a PHP function call that occurs sizeen a specific event occurs.

    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see <https://www.gnu.org/licenses/>.
    */
    ?>

    <?php
    //----------Extract Post Thumbnail For Manul Sizing----------//
    function wpgym_extract_post_thumb( $str ){
    $matches = array();
    $pattern = '/src=[\'"]?([^\'" >]+)[\'" >]/';
    $match = preg_match( $pattern, $str, $matches );
    return($matches[1]);
    }
    //----------Display The Relted Posts----------//
    function related_post() {

    global $wpdb, $post, $table_prefix;

    if ($post->ID) {

    $retval = '
    <br clear="all"/><hr/>Related Post: ';

    // Get tags
    $tags = wp_get_post_tags($post->ID);
    $tagsarray = array();
    foreach ($tags as $tag) {
    $tagsarray[] = $tag->term_id;
    }
    $tagslist = implode(',', $tagsarray);

    // Do the query
    $q = "
    SELECT p.*, count(tr.object_id) as count
    FROM $wpdb->term_taxonomy AS tt, $wpdb->term_relationships AS tr, $wpdb->posts AS p
    WHERE tt.taxonomy ='post_tag'
    AND tt.term_taxonomy_id = tr.term_taxonomy_id
    AND tr.object_id = p.ID
    AND tt.term_id IN ($tagslist)
    AND p.ID != $post->ID
    AND p.post_status = 'publish'
    AND p.post_date_gmt < NOW()
    GROUP BY tr.object_id
    ORDER BY count DESC, p.post_date_gmt DESC
    LIMIT 5;";

    $related = $wpdb->get_results($q);

    if ( $related ) {
    foreach($related as $r) {
    $retval .= '
    <span><a title="'.wptexturize($r->post_title).'" href="'.get_permalink($r->ID).'">'.wptexturize($r->post_title).'</a></span> |
    ';
    }
    } else {
    $retval .= '
    <span>No related posts found</span>
    ';
    }
    $retval .= '<hr/>
    ';
    return $retval;
    }
    return;
    }
    //----------Display Mp3----------//
    function PostAudio(){
    if (function_exists("insert_audio_player")) {
    $audiofile = get_post_meta($post->ID, audio, true);
    $author = get_the_author();
    $podcasttitle = get_the_title($post->ID);
    // do we have one?
    if($audiofile) {
    return''.insert_audio_player('[audio:'.$audiofile.'|titles='.$podcasttitle.'|artists='.$author.'|width=100%]').'
    <a href="' . get_bloginfo ( 'url' ).'/audio/'.$audiofile.'">Click to Download the Audio File</a>' . get_bloginfo ( 'audio' ).'';
    }
    }
    }
    //----------Display The Modify Rss Feed----------//
    function postTitle($title) {
    return $title;
    }
    function PostThumb($content) {
    if($content){ $content = $content; $brake = ''; }else{ $content = '<br/>'; $brake = '<br/>';}//Check if the post has content .
    if(current_theme_supports('post-thumbnails')){//Check if the theme has Post Thumbnail Support.
    if(has_post_thumbnail()) { //Check if the post has a Post Thumbnail assigned to it.
    $body ='<img width="100" height="100" alt="Post Thumnale" src="'.wpgym_extract_post_thumb(get_the_post_thumbnail()).'" class="wp-post-image alignleft" align="left"><div align="justify">'.$content.'</div>'.$brake.''.related_post().''.PostAudio().'Tags: '.get_the_tag_list('',', ','<br/>').'<hr/>';
    }else{
    $body ='<img width="100" height="100" alt="Placer Hoilder IMG" src="'.plugins_url('images/place-Holder.png' , __FILE__).'" class="wp-post-image alignleft" align="left"><div align="justify">'.$content.'</div>'.$brake.''.related_post().''.PostAudio().'Tags: '.get_the_tag_list('',', ','<br/>').'<hr/>';
    }
    }else{
    $body ='<div align="justify">'.$content.'</div>'.$brake.''.related_post().''.PostAudio().'Tags: '.get_the_tag_list('',', ','<br/>').'<hr/>';
    }
    return $body;
    }
    add_filter('the_title_rss', 'postTitle');
    add_filter('the_excerpt_rss', 'PostThumb');
    add_filter('the_content_rss', 'PostThumb');
    //----------Display The Modify Rss Feed----------//
    function excerpt_ellipse($text) {
    return'<script>
    function removeElement(id) {
    var element = document.getElementById(id);
    element.parentNode.removeChild(element);
    }
    window.onload = function() {
    removeElement("more")
    };
    </script>'.$text.'';
    }
    add_action('do_feed', 'excerpt_ellipse', 1);
    add_action('do_feed_rdf', 'excerpt_ellipse', 1);
    add_action('do_feed_rss', 'excerpt_ellipse', 1);
    add_action('do_feed_rss2', 'excerpt_ellipse', 1);
    add_action('do_feed_atom', 'excerpt_ellipse', 1);
    add_filter('the_excerpt_rss', 'excerpt_ellipse',1);
    add_filter('the_content_rss', 'excerpt_ellipse',1);
    ?>

    Way do toy want to add this feature

    add logout timeout for admins so admins working on a local dev environment can stay lodging for however long they want.

    I agree

    ?

    Thread Starter DJABHipHop

    (@pressthemes1)

    Thread Starter DJABHipHop

    (@pressthemes1)

    @qriouslad this what i’m using since my theme has search filter to filter search result by post format with works but not 100% if you decide to not add my suggestion please let me know what i’m doing wrong with my code instead.

    /**
    * Change search page slug.
    */
    function wpb_change_search_url() {
    if ( is_search() && ! empty( $_GET['s'] ) ) {
    $paged = '';
    $post_format = '';

    if ( get_query_var( 'paged' ) > 0 ) {
    $paged = '/page/' . urlencode( get_query_var( 'paged' ) );
    }

    if ( isset( $_GET['post_format'] ) && ! empty( $_GET['post_format'] ) ) {
    $post_format = '/type/' . urlencode( sanitize_text_field( strtolower( $_GET['post_format'] ) ) );
    }

    wp_redirect( home_url( "/search/" ) . urlencode( get_query_var( 's' ) ) . $post_format . $paged );
    exit();
    }
    }
    add_action( 'template_redirect', 'wpb_change_search_url' );

    /**
    * Adds the rewrite rule for search with post_format and pagination.
    */
    function custom_search_rewrite_rule() {
    if ( '' != get_option( 'permalink_structure' ) ) {
    // Search with post format
    add_rewrite_tag( '%type%', '(.+)', 'post_format=' );
    add_rewrite_tag( '%page%', '(.+)', 'paged=' );
    add_rewrite_tag( '%search%', '(.+)', 's=' );

    // Search with post format and pagination
    add_rewrite_rule( 'search/(.+)/type/?([^/]+)/page/?([0-9]{1,})/?$', 'index.php?s=$matches[1]&paged=$matches[2]&post_format=$matches[3]', 'top');

    // Search with post format only
    add_rewrite_rule( 'search/(.+)/type/?([^/]+)/?$', 'index.php?s=$matches[1]&post_format=$matches[2]', 'top');

    // Search with pagination only
    add_rewrite_rule( 'search/(.+)/page/?([0-9]{1,})/?$', 'index.php?s=$matches[1]&paged=$matches[2]', 'top');

    // Search only
    add_rewrite_rule( 'search/(.+)/?$', 'index.php?s=$matches[1]', 'top');
    }
    }
    add_action( 'init', 'custom_search_rewrite_rule' );

    /**
    * Flush rewrite rules on theme activation or plugin activation (run once).
    */
    function flush_search_rewrite_rules() {
    custom_search_rewrite_rule();
    flush_rewrite_rules();
    }
    add_action( 'after_switch_theme', 'flush_search_rewrite_rules' );
    add_action( 'activated_plugin', 'flush_search_rewrite_rules' );
    • This reply was modified 4 months, 3 weeks ago by DJABHipHop.
    Thread Starter DJABHipHop

    (@pressthemes1)

    its valid in 2024, and im using a code snippet the old AF

    Thread Starter DJABHipHop

    (@pressthemes1)

    @qriouslad Bug gone with the fix

Viewing 15 replies - 16 through 30 (of 105 total)