Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Thank you @alanfuller. You’re right that the file was present, just that $detect wasn’t defined. Your addition fixed my code!

    Happy holidays

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    That’s a fair point @alanfuller. I suppose I want more granular control that won’t be possible with CSS.

    I know that my require is pointing toward the file because I got it wrong the first time and this following code doesn’t give me a ‘not found’ warning. So I assume the file has been included.

        require_once __DIR__ . '/Mobile_Detect.php';
    function subscribe_form(){
    
        if ( $detect->isMobile() ) {
        $form_widget = new \MailPoet\Form\Widget();
    return $form_widget->widget(array('form' => 1, 'form_type' => 'php'));
    }}
    add_shortcode('subscribe', 'subscribe_form');

    $detect is defined in the github file I linked above and I’m able to call it everywhere except within a function in a plugin.

    Why did my embedded link to the github project become “The page I need help with”? Good to be aware of for the future.

    Thank you for your time

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Thanks to bcworkz I have solved my puzzle. Here’s my work for anybody who might happen along here in the future.

    Inside the loop:

    <button style="background:#289700;" onclick="playEpisodes(<?php echo get_the_ID();?>)">Play Episode</button>
    
        <div style="display:none" id="invis-image<?php echo get_the_ID();?>"><?php echo $image[0];?></div>
        <div style="display:none" id="invis-mp3<?php echo get_the_ID();?>"><?php echo the_field('link'); ?></div>
        <div style="display:none" id="invis-url<?php echo get_the_ID();?>"><?php echo the_permalink(); ?></div>

    Outside loop:

    <script> function playEpisodes(theID) {
            
            // Make player visible
                document.getElementById("player").style.display = "inherit";
            
            // Calculate Source IDs
                var imageElement = "invis-image" + theID;
                var mp3Element = "invis-mp3" + theID;
                var urlElement = "invis-url" + theID;
            
            // Insert the image
                var invisimg = document.getElementById(imageElement).innerHTML;
                document.getElementById("player-img").src = invisimg;
            
            // Insert URL
                var invisurl = document.getElementById(urlElement).innerHTML;
                document.getElementById("ep-url").action = invisurl;
            
            // Insert the mp3
                var invismp3 = document.getElementById(mp3Element).innerHTML;
                            
            // Play the mp3
            document.getElementById("audio-source").src = invismp3;
            document.getElementById("download").href = invismp3;
                var audio = document.getElementById('audio-source');
    audio.play();
            document.getElementById("ply").style.display = "none";
            document.getElementById("pse").style.display = "inline-block";
                }
        
        </script>

    And my player:

    <div style="display:none" id="player" class="pcast-player">
          
        <img id="player-img" style="width: 100px;float: left;padding: 10px;" src="">
    <div class="pcast-player-controls">
        <button id="ply" title="Play" class="pcast-play"><i class="fa fa-play"></i></button>
        <button id="pse" title="Pause" class="pcast-pause"><i class="fa fa-pause"></i></button>
        <button title="Remind" class="pcast-rewind"><i class="fa fa-fast-backward"></i></button>
        <button title="Forward" class="pcast-forward"><i class="fa fa-fast-forward"></i></button>
        <span class="pcast-currenttime pcast-time">00:00</span>
        <progress class="pcast-progress" value="0"></progress>
        <span class="pcast-duration pcast-time">00:00</span>
        <button title="Change Speed" class="pcast-speed">1x</button>
        <button title="Mute" class="pcast-mute"><i class="fa fa-volume-up"></i></button>
        <button title="Download" class="pcast-down"><a id="download" style="color:#fff" href="" class="fa fa-download" download=""></a></button>
        <form style="display:inline-block;" id="ep-url" method="get" action=""><button type="submit" title="Visit episode page">Episode details</button></form>
      <audio id="audio-source" src=""></audio>
    
    </div>

    The functionality is that the button is clicked within an item in the loop, the fixed position player appears (display:none to display:inherit) with the post’s data loaded into it, it plays automatically, and can be replaced by clicking a button in another item – starting the process over again.

    Thanks to the whole WordPress community!

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Thank you @bcworkz ! This didn’t occur to me.
    My reasoning behind me choosing to not simply switch the display attributes (good idea, by the way) is because I’m targeting an <audio> tag also and want to avoid having an invisible audio file playing on top of the currently selected one.
    I could also just learn how to pause the hidden element with JQuery, come to think of it lol

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Excuse my noobish mistake. I forgot to change my onclick variable, but my function no longer wants to play ball.

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Please forgive me. I’m very stressed this week. I should have been more attentive.

    Thank you

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    @tw2113 It seems this issue is technically solved. I’ll have to live with a workaround if I want to keep using this other plugin.
    Thank you for your time

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    @tw2113 Yes, that URL brings me to the correct page.

    I’m using Admin Menu Editor. This may also just be user error. Sorry if that’s the case

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Thanks @bcworkz I’m more of a javascript guy and function layouts are confusingly similar.
    Can you look at this amended code for my second feed and tell me if there’s something off? Do I add_action again? It doesn’t seem generate the feed or an error, either way.

    add_action('init', 'crRSS');
    function crRSS(){
            add_feed('cr', 'crRSSFunc');
    }
    function crRSSFunc(){
            get_template_part('rss', 'cr');
    }
    • This reply was modified 1 year ago by unsavouryindividual. Reason: Old code snippet needed updating
    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Thank you for your time @bcworkz, but I’m afraid it may have been abused. For whatever magical reason I can’t comprehend, player.fm started reading my feed and it’s working fine on Spotify.

    The only thing I can do to help anyone potentially in my position is to say don’t bother with Google Play Podcasts namespaces – those people don’t know what they’re doing. Also, take a look at how my feed is arranged for an idea of what podcast aggregators are looking for.

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Hi and thanks @bcworkz

    That’s strange. I imagined it was hierarchical when I followed a tutorial to that URL.
    What’s also strange is that w3.org thinks it’s fine. Podbase thinks it’s fine. Brave Browser and Firefox display it like any ordinary unstyled feed, while Opera displays it without errors in its inbuilt feed reader.

    I should have shared the function snippet I was instructed to use:

    add_action('init', 'customRSS');
    function customRSS(){
            add_feed('tab', 'customRSSFunc');
    }
    function customRSSFunc(){
            get_template_part('rss', 'tab');
    }
    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    I’ve solved my own puzzle!

    .rpwwt-widget li {
    	display:flow-root;
    	}
    .rpwwt-widget img {
    	float:left;
    	}
    
    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    Yeah, I’m just gonna slink on out of here in embarrassment after I explain my mistake.
    “top_nav” in the theme should be “top-menu”

    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    This is a proper array to call a post type, taxonomy, and term into a wp_query in an RSS file

    $args = array(
      'post_type' => 'shows' ,
      'orderby' => 'date' ,
      'order' => 'DESC' ,
      'posts_per_page' => -1,
        'tax_query'      => array(
                array(
                    'taxonomy'  => 'show',
                     'field'     => 'tag_ID',
                      'terms'     => '3'
                )
            )
    ); 
    $q = new WP_Query($args);
            while($q->have_posts()) : $q->the_post(); ?>
    Thread Starter unsavouryindividual

    (@unsavouryindividual)

    You’re probably right now that I look at the situation. I just wanted to avoid injecting the extra iTunes (etc) tags and custom field into ALL my feeds through the functions file.
    I’ll spend some time learning to use pre_get_posts and will share my results here for anyone who’ll search like I did in the future.

    Thanks

Viewing 15 replies - 1 through 15 (of 16 total)