WordPress.org

Ready to get started?Download WordPress

Forums

Auto Attachments
[resolved] Need to insert mp3 player on page created by plugin (9 posts)

  1. rwwood
    Member
    Posted 1 year ago #

    I'm using iThemes builder for my theme, and one of the plugins that comes with it is for listing mp3 sermons on a church site. The url for the listing page is http://www.mysite.com/sermons. Any new sermons added via the plugin will be listed on that page. (the page doesn't show up in the WP pages list) There is an mp3 player on the page for each individual sermon, but not on the listing page, where I would like to have one. There is a link there which opens a player in a new browser tab, but that's not what I want.

    Is it possible to add a function to your plugin to allow it to insert the player on a specific URL?

    Thanks.
    RW Wood

    http://wordpress.org/extend/plugins/auto-attachments/

  2. Serkan Algur
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Are you attach your mp3s (upload to your site)?

    If you don't, plugin can't see unattached items or dynamically generated contents for now.

    I'm working on it.

  3. rwwood
    Member
    Posted 1 year ago #

    Yes, the mp3 files are attached to each of the posts on the listing page. There is a link to the mp3 that opens an ugly player in another tab, but I'd like to see your player there instead.

  4. Serkan Algur
    Member
    Plugin Author

    Posted 1 year ago #

    Ok then, your mp3 list plugin uses a different way to open/play your files.

    Which plugin you use for listing your mp3s? If you can give name of the plugin i can make a search for codes.

  5. rwwood
    Member
    Posted 1 year ago #

    It's from a paid theme by iThemes. If you tell me what I'm looking for, I'll try to find the needed code.

  6. rwwood
    Member
    Posted 1 year ago #

    Actually, here's the template.php file for the listing page.

    <?php
    /**
     *	This is the template for displaying archive sermons.
     *
     *	@package		Builder Block Church
     *	@subpackage		Templates
     *	@author			Justin Kopepasah
     *	@since			1.1.0
     *
     *	DO NOT EDIT THIS TEMPLATE.
     *
     *	If you wish to use a custom template, copy this template over
     *	to your theme and rename the template to archive-sermon.php.
    */
    
    function render_content() {
    	global $post;
    ?>
    	<?php if ( have_posts() ) : ?>
    		<div class="loop sermon-archive">
    			<div class="loop-header">
    				<h4 class="loop-title"><?php _e( 'Sermons', 'it-l10n-builder-block-church' ); ?></h4>
    			</div>
    
    			<div class="loop-content">
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php $audio = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'audio' ) ); ?>
    					<div id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?>>
    						<div class="entry-header">
    							<h3 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    							<span class="sermon-date"><?php printf( __( ' Posted on %s', 'it-l10n-builder-block-church' ), get_the_date() ); ?><span>
    							<span class="sermon-tags"><?php printf( __( ' in %s', 'it-l10n-builder-block-church' ), get_the_term_list( $post->ID, 'sermon_tag', '', ', ', '' ) ); ?></span>
    							<?php if ( ! empty( $audio ) ) : ?>
    								<?php _e( '| MP3', 'it-l10n-builder-block-church' ); ?><?php if ( count( $audio ) >= 2 ) { echo 's'; } else { echo ' -'; } ?>
    								<?php foreach ( $audio as $attachment_id => $attachment ) : ?>
    									<span class="sermon-mp3"> <?php if ( count( $audio ) >= 2 ) { echo "-"; } ?> <a href="<?php echo wp_get_attachment_url( $attachment_id, 'full' ); ?>" target="_blank" title="<?php echo wp_get_attachment_link( $attachment_id, '' , false, false, ' '); ?>" rel="audio-file"><?php echo $attachment->post_title; ?></a></span>
    								<?php endforeach; ?>
    							<?php endif; ?>
    						</div>
    						<div class="entry-content">
    							<?php if ( has_post_thumbnail() ) : ?>
    								<?php the_post_thumbnail( 'sermon-archive', array( 'class' => 'alignright' ) ); ?>
    							<?php endif; ?>
    							<?php the_content( __( 'View Sermon &rarr;', 'it-l10n-builder-block-church' ) ); ?>
    						</div>
    					</div>
    
    					<?php comments_template(); // include comments template ?>
    				<?php endwhile; // end of one post ?>
    			</div>
    
    			<div class="loop-footer">
    				<!-- Previous/Next page navigation -->
    				<div class="loop-utility clearfix">
    					<div class="alignleft"><?php previous_posts_link( __( '&laquo; Previous Sermon', 'it-l10n-builder-block-church' ) ); ?></div>
    					<div class="alignright"><?php next_posts_link( __( 'Next Sermon &raquo;', 'it-l10n-builder-block-church' ) ); ?></div>
    				</div>
    			</div>
    		</div>
    	<?php else : // do not delete ?>
    		<?php do_action( 'builder_template_show_not_found' ); ?>
    	<?php endif; // do not delete ?>
    <?php
    }
    
    add_action( 'builder_layout_engine_render_content', 'render_content' );
    do_action( 'builder_layout_engine_render', basename( __FILE__ ) );
  7. Serkan Algur
    Member
    Plugin Author

    Posted 1 year ago #

    Copy and save this code to archive-sermon.php, change http://yoursite.com to your domain and upload to your theme's folder. I think this code will work for you. If it don't please tell me.

    Have a nice day

    <?php
    /**
     *	This is the template for displaying archive sermons.
     *
     *	@package		Builder Block Church
     *	@subpackage		Templates
     *	@author			Justin Kopepasah
     *	@since			1.1.0
     *
     *	DO NOT EDIT THIS TEMPLATE.
     *
     *	If you wish to use a custom template, copy this template over
     *	to your theme and rename the template to archive-sermon.php.
    */
    
    function render_content() {
    	global $post;
    ?>
    	<?php if ( have_posts() ) : ?>
    		<div class="loop sermon-archive">
    			<div class="loop-header">
    				<h4 class="loop-title"><?php _e( 'Sermons', 'it-l10n-builder-block-church' ); ?></h4>
    			</div>
    
    			<div class="loop-content">
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php $audio = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'audio' ) ); ?>
    					<div id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?>>
    						<div class="entry-header">
    							<h3 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    							<span class="sermon-date"><?php printf( __( ' Posted on %s', 'it-l10n-builder-block-church' ), get_the_date() ); ?><span>
    							<span class="sermon-tags"><?php printf( __( ' in %s', 'it-l10n-builder-block-church' ), get_the_term_list( $post->ID, 'sermon_tag', '', ', ', '' ) ); ?></span>
    							<script language='javascript' type='text/javascript' src='http://yoursite.com/wp-content/plugins/auto-attachments/includes/jw/swfobject.js'></script>
    							<ul>
    							<?php if ( ! empty( $audio ) ) : ?>
    								<?php _e( '| MP3', 'it-l10n-builder-block-church' ); ?><?php if ( count( $audio ) >= 2 ) { echo 's'; } else { echo ' -'; } ?>
    								<?php foreach ( $audio as $attachment_id => $attachment ) : ?>
    									<li>
    										<div id='mediaspace-<?php echo wp_get_attachment_link( $attachment_id, '' , false, false, ' '); ?>'></div>
    											<script type='text/javascript'>
    											var so = new SWFObject('http://yoursite.com/wp-content/plugins/auto-attachments/includes/jw/player.swf','ply','470','24','9','#000000');
    												so.addParam('allowfullscreen','false');
    												so.addParam('allowscriptaccess','always');";
    												so.addParam('wmode','opaque');";
    												so.addVariable('file','<?php echo wp_get_attachment_url( $attachment_id, 'full' ); ?>');";
    												so.write('mediaspace-<?php echo wp_get_attachment_link( $attachment_id, '' , false, false, ' '); ?>');";
    												</script>
    												<span class='mp3title'><?php echo $attachment->post_title; ?></span>";
    									</li>
    								<?php endforeach; ?>
    							<?php endif; ?>
    							</ul>
    						</div>
    						<div class="entry-content">
    							<?php if ( has_post_thumbnail() ) : ?>
    								<?php the_post_thumbnail( 'sermon-archive', array( 'class' => 'alignright' ) ); ?>
    							<?php endif; ?>
    							<?php the_content( __( 'View Sermon →', 'it-l10n-builder-block-church' ) ); ?>
    						</div>
    					</div>
    
    					<?php comments_template(); // include comments template ?>
    				<?php endwhile; // end of one post ?>
    			</div>
    
    			<div class="loop-footer">
    				<!-- Previous/Next page navigation -->
    				<div class="loop-utility clearfix">
    					<div class="alignleft"><?php previous_posts_link( __( '« Previous Sermon', 'it-l10n-builder-block-church' ) ); ?></div>
    					<div class="alignright"><?php next_posts_link( __( 'Next Sermon »', 'it-l10n-builder-block-church' ) ); ?></div>
    				</div>
    			</div>
    		</div>
    	<?php else : // do not delete ?>
    		<?php do_action( 'builder_template_show_not_found' ); ?>
    	<?php endif; // do not delete ?>
    <?php
    }
    
    add_action( 'builder_layout_engine_render_content', 'render_content' );
    do_action( 'builder_layout_engine_render', basename( __FILE__ ) );
  8. rwwood
    Member
    Posted 1 year ago #

    No, that doesn't change anything. I still am not getting the player. Don't spend a lot of time on this, though as I think I've found another solution.

    Thanks.

  9. Serkan Algur
    Member
    Plugin Author

    Posted 1 year ago #

    OK then

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.