Forum Replies Created

Viewing 15 replies - 1 through 15 (of 30 total)
  • Thread Starter delirium6

    (@delirium6)

    Hi @click5 ,

    I watch your plug-in code.

    You put this :

    if(esc_attr(get_option("click5_sitemap_seo_cron")) === "1"){
        if (! wp_next_scheduled ( 'click5_sitemap_seo_cron' )) {
          wp_schedule_event(time(), 'daily', 'click5_sitemap_seo_cron');
        }
      }

    You configure to do the task 1 time per day, so it’s ok for me. But you could add a parameter to set personnal interval.

    But, you forget to call wp_clear_scheduled_hook(‘click5_sitemap_seo_cron’) on deactivation plugin or uncheck the cron settings.

    regards.

    Thread Starter delirium6

    (@delirium6)

    Hi @click5 ,

    Can I call a function or a php file of your plug-in with a crontask that i will configure every night at 23PM on my webserver for example ?

    Thanks

    Thread Starter delirium6

    (@delirium6)

    Hi @click5 ,

    I have installed the new version of your plug-in and i checked the new option for cronjob generation.

    For the other things, i will wait no problem.

    Just a question about the cronjob, when did you decide to regenerate it by cronjob ?
    Because i call the cronjob evry 5 minutes.
    It will generate it every 5 minutes ?

    Regards

    Thread Starter delirium6

    (@delirium6)

    Peter,

    After debugging, i find my answer in wordpress core.
    They need the publish_posts capabilitiees.
    I will change that.

    Your plug-in work nice from many years.

    Regards

    Thread Starter delirium6

    (@delirium6)

    Hi,

    Thank you for considering these new features.

    I will wait the next version, for the moment i generate it manually.

    For the History Log plugin, it seems to be an interesting plugin, i will see if it could be use in our websites.

    Regards.

    Thread Starter delirium6

    (@delirium6)

    Hi pepe,

    Did you find the problem ?

    Regards

    Thread Starter delirium6

    (@delirium6)

    Thanks for your help @pputzer

    Thread Starter delirium6

    (@delirium6)

    I put the final solution :

    add_filter('post_thumbnail_html', 'caption_featured_images',11,5);
    
    function caption_featured_images( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
        if(is_single( $post_id ))
        {
            if ( $post = get_post( $post_thumbnail_id ) ) {
                if ( $size = wp_get_attachment_image_src( $post->ID, $size ) )
                    $width = $size[1];
                else
                    $width = 0;
                    
                $html='<div class="media-credit-container alignnone" '.($width!=0?'style="max-width:'.$width.'px;"':'').'>'.$html.'</div>';
        
                $html = img_caption_shortcode(
                    array(
                        'caption' => trim( "$post->post_content" ),
                        'class'   => '',
                        'width'   => $width,
                        'id'       => 'attachment_'.$post_thumbnail_id
                    ),
                    $html       
                );
            }
        }
            
        return $html;
     }
    Thread Starter delirium6

    (@delirium6)

    Sorry @pputzer , but i doesn’t know what to do in the hook to put the caption like in your plugin.

    In another side, in my single page i tried to use this without success :
    echo do_shortcode(‘[caption][media-credit standalone=false]’.get_the_post_thumbnail( $post_id, ‘photo_une’).'[/media-credit][/caption]‘);
    It’s a good or bad way ?

    Regards

    Thread Starter delirium6

    (@delirium6)

    Ok, next time i will create a new Thread.

    Ok no problem i understand your point of view.
    But to solve my problem i’m a little loose.
    You tell me to put a Hook on post_thumbnail_html.
    You already have a hook on it with ‘add_media_credit_to_post_thumbnail’.
    In this function there is :

    		// Return early if we are not in the main loop or credits are to displayed at end of posts.
    		if ( ! \in_the_loop() || ! empty( $this->settings['credit_at_end'] ) ) {
    			return $html;

    I’m not in this 2 cases because i got the credit but not the caption.
    Where is your code which write the caption ? because i think it’s this function that i need to hook.

    Or can i use a shortcode ?

    Thread Starter delirium6

    (@delirium6)

    Hi @pputzer ,

    Are you instering in ?

    Other subjet, you use the itemprop attributes in media credit, but it’s not compatible with W3C if the parent haven’t got the itemscope attribute.
    See chapter 4.2 https://www.w3.org/TR/microdata/

    Regards

    Thread Starter delirium6

    (@delirium6)

    No problem, yes i want the caption displayed on single page for featured images.
    Could you be intesrested on this feature ? i can help you to add this feature on your plugin. Otherwise i will do as you tell me.

    Regards

    Thread Starter delirium6

    (@delirium6)

    Hi,

    error_log doesnt’t work, in my code if i put an error_log nothing is output or display.
    So i can’t debug.
    To display an image i use : the_post_thumbnail('photo_une',['title' => get_the_title()] );

    Can i use a media credit function to display the caption ?

    I put this to debug :

    add_filter( 'media_credit_post_thumbnail', function( $output ) {
        error_log("should display the post thumbnail credit");
    	echo 'should display the post thumbnail credit';
        return $output;
    } );

    if you on go the page you will see this message before the image : should display the post thumbnail credit’

    • This reply was modified 4 years, 2 months ago by delirium6.
    Thread Starter delirium6

    (@delirium6)

    Sorry i don’t understand, error_log doesn’t work with :
    define( ‘WP_DEBUG’, true );
    define( ‘WP_DEBUG_LOG’, true );
    define( ‘WP_DEBUG_DISPLAY’, true);
    @ini_set( ‘display_errors’, 1 );

    Thread Starter delirium6

    (@delirium6)

    Yes Display credit for featured images” is enabled but i don’t want it on home page, just in single page.

    Here the code :

    <?php get_header(); ?>
    
    	<img src="<?php echo get_template_directory_uri(); ?>/img/pub/pub970_90.png" alt="pub">
    
    	<?php
    		$post_id = 0;
    		if (have_posts()): while (have_posts()) : the_post(); ?>
    
    			<main id="contentbigone">
    			<?php 
    			$post_id = get_the_ID();
    			echo '
    				<div class="article round-all">'.afficherTheme($post_id, True, True).'
    					<span class="titre-article">'.get_the_title().'</span><br />
    					<span class="chapeau-article">'.get_field( 'Accroche').'</span>';
    						//Image
    						if ( has_post_thumbnail() ) {
    							echo '<div class="media-credit-container">';
    							the_post_thumbnail('photo_une',['title' => get_the_title()] );
    							echo '</div>';
    						}
    			echo '
    							<div class="infoslecture ">
    								'.partager("Grey","smallmargintop").'<div>
    								<span class="spaceimg aligneimgvert"><img src="'.get_template_directory_uri().'/img/icons/IconReading.png" alt="Temps de lecture"> '.tempsLecture().'  <img src="'.get_template_directory_uri().'/img/icons/IconViews.png" alt="Nombre de vues"> '.do_shortcode( '[post-views]' ).'</span><br>
    								<span class="spaceimg aligneimgvert"><img src="'.get_template_directory_uri().'/img/icons/IconAuthor.png" alt="Publication"> PUBLIé LE '.get_the_time('d/m/Y').' PAR '.get_the_author().'</span></div>
    							</div>
    			</div>';
    			?>
    			</main>
    			
    			<main id="contentone" >
    				<?php 		
    					echo '
    					<!-- article -->
    					<article id="post-'.$post_id.'" class="article article-content round-all margintop">';
    					the_content();
    					echo '<div class="donnez-votre-avis round-all"><a href="'.get_the_permalink().'">DONNEZ VOTRE AVIS</a></div>
    				</article>
    				<!-- /article -->';
    						?>
    			</main>
    		
    		
    
    	<?php endwhile; ?>
    
    	<?php else: ?>
    
    		<!-- article -->
    		<article>
    
    			<h1><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h1>
    
    		</article>
    		<!-- /article -->
    
    	<?php endif; ?>
    
    		<?php get_sidebar("single-one"); ?>
    	<main id="contenttwo">
    	</main>
    	<?php get_sidebar("single-two"); ?>
    	<img src="<?php echo get_template_directory_uri(); ?>/img/pub/pub970_90.png" alt="pub">
    	
    <?php get_footer(); ?>
Viewing 15 replies - 1 through 15 (of 30 total)