badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

The service "Read More" link not correct

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #45013
    Mark L
    Participant

    I am using the Interface Pro theme with Business Template and on the static front page the service widget “Read More” links are not correct for the service pages. I am using the Default Template for the posts and the service pages are using the Default Template also. The URL is https://acumenappliancescloud.com.

    I have also tried to add the Services Widget to the Services Template and the same issue exists there also. Each “Read More” link is to the current page.

    #45057

    Hi Mark L,

    Did you made any code custoimization on the theme? If not then first of all deactivate all the plugins that you have installed on your dashboard and check whether the same problem occurs or not, let us know.

    Thank you!

    #45087
    Mark L
    Participant

    I have made no code changes. Are these links dynamically created? Or do they need to be added again?

    The plugins I have installed are required and will need reconfiguration if they are all deactivated, this is a poor solution. Where are the links set in the theme code? Why can’t this be modified or fixed there?

    #45088
    Mark L
    Participant

    Deactivated all plugins that are not critical, still the same issue. This needs to be fixed on this public web site ASAP.

    #45089
    Mark L
    Participant

    Why are the Featured Work section links working and the Services links not if there is a plugin conflict? This should be easily determined from your code and not depend on other plugins.

    #45090

    Hi Mark L,

    No you don’t need to add it again. The links are created dynamically. Only there will be some conflict with some plugins not all and we cannot guarantee that all third party plugins will work fine on our theme too.

    We have used<?php the_permalink(); ?> to display the link on both service and recent work widgets. After a bit dig on the theme goto theme folder -> inc -> widgets -> interface_widgets.php on line no 341 you will find below code

    <a class="more-link" title="<?php the_title_attribute(); ?>" href="<?php the_permalink(); ?>">

    replace with

    <a class="more-link" title="<?php the_title(); ?>" href="<?php the_permalink(); ?>">

    If this fix or not let us know.

    Thank you!

    #45092
    Mark L
    Participant

    I was digging on my own to fix this, I was in the same part of the code and have fixed the issue.

    On line 317 add this line:
    $page_permalink = get_permalink();

    Changed line 341 to:
    <a class="more-link" title="<?php echo esc_attr($page_title);?>" href="<?php echo esc_attr($page_permalink); ?>">

    The $page_title is already defined. This resolves the issue but I do not have a child theme for this fix. Leaving “the_permalink()” in line 341 does not work.

    Please advise on how this will be resolved in the current code release and how I will need to update my theme.

    #45109

    Hi Mark L,
    The above code which you have used and our main default code does the same function. This is the plugin conflict with the permalink so get_permalink() is working with your theme but not the_permalink()

    If you like to fix the issues then you can use in the same way you did. Yes child theme is required for this. Either you need to do the same changes in the code again and again while updating to new version or better make child theme and customize the code.

    you can create a child theme with style.css and functions.php file. In functions.php of the child theme, create your widgets and register them. Just copy the parent widget, change the name of widget like Theme Horse Child: Service Child Widget, make customisation and create your custom widget. If you do this, the widgets of parent theme and child both will appear. Use your custom widget of child theme instead of the parent theme.

    Just making same file structure in the child theme like /library/widgets won’t overwrite the parent file. Hope this helps.

    Under functions.php add below code

    register_widget("interface_child_service_widget");
    
    /* Start */
    class interface_child_service_widget extends WP_Widget {
    
     	function interface_service_widget() {
    		$widget_ops = array( 'classname' => 'widget_service', 'description' => __( 'Display Services( Business Layout )', 'interface' ) );
    		$control_ops = array( 'width' => 200, 'height' =>250 ); 
    		parent::__construct( false, $name = __( 'Theme Horse: Services', 'interface' ), $widget_ops, $control_ops);
    	}
    
    	function form( $instance ) {
    		$instance = wp_parse_args( (array) $instance, array( 'number' => '8','page_id0'=>'','page_id1'=>'','page_id2'=>'','page_id3'=>'','page_id4'=>'','page_id5'=>'','page_id6'=>'','page_id7'=>'',));
    		$number = absint( $instance[ 'number' ] );
    		for ( $i=0; $i<$number; $i++ ) {
    			$var = 'page_id'.$i;
    			$defaults[$var] = '';
    		} ?>
    		<p>
    			<label for="<?php echo $this->get_field_id('number'); ?>">
    				<?php _e( 'Number of Services:', 'interface' ); ?>
    			</label>
    			<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" />
    		</p>
    
    		<?php	for ( $i=0; $i<$number; $i++ ) {
    			$var = 'page_id'.$i;
    			$var = absint( $instance[ $var ] );
    		}
    		?>
    		<?php for( $i=0; $i<$number; $i++) { ?>
    		<p>
    			<label for="<?php echo $this->get_field_id( key($defaults) ); ?>">
    				<?php _e( 'Page', 'interface' ); ?>
    				:</label>
    				<?php wp_dropdown_pages( array( 'show_option_none' =>' ','name' => $this->get_field_name( key($defaults) ), 'selected' => $instance[key($defaults)] ) ); ?>
    			</p>
    			<?php
    		next( $defaults );// forwards the key of $defaults array
    	}
    }
    
    function update( $new_instance, $old_instance ) {
    	$instance = $old_instance;
    	$instance['number'] = absint( $new_instance['number'] );
    
    	for( $i=0; $i<$instance['number']; $i++ ) {
    		$var = 'page_id'.$i;
    		$instance[ $var] = absint( $new_instance[ $var ] );
    	}
    
    	return $instance;
    }
    
    function widget( $args, $instance ) {
    	extract( $args );
    	extract( $instance );
    	$number = empty( $instance['number'] ) ? 8 : $instance['number'];
    
    	global $post;
    	global $options, $array_of_default_settings;
     	$options = wp_parse_args( get_option( 'interface_theme_options', array() ), interface_get_option_defaults());
    	$page_array = array();
    	for( $i=0; $i<$number ; $i++ ) {
    		$var = 'page_id'.$i;
    		$page_id = isset( $instance[ $var ] ) ? $instance[ $var ] : '';
    
    		if( !empty( $page_id ) )
     				array_push( $page_array, $page_id );// Push the page id in the array
     		}
     		$get_featured_pages = new WP_Query( array(
     			'posts_per_page' 			=> -1,
     			'post_type'					=>  array( 'page' ),
     			'post__in'		 			=> $page_array,
     			'orderby' 		 			=> 'post__in'
     			) ); 
     			echo $before_widget; ?>
     			<div class="column clearfix">
     				<?php 
     				$j = 1;
     				while( $get_featured_pages->have_posts() ):$get_featured_pages->the_post();
     				$page_permalink = get_permalink();
     				$page_title = get_the_title();
     				if( $j % 4 == 3 && $j > 1 ) {
     					$service_class = "one-fourth clearfix-half";
     				}
     				elseif ( $j % 4 == 1 && $j > 1 ) {
     					$service_class = "one-fourth clearfix-half clearfix-fourth";
     				}	
     				else {
     					$service_class = "one-fourth";
     				}			
     				?>
     				<div class="<?php echo $service_class; ?>">
     					<div class="service-item clearfix">
     						<?php 
     						if ( has_post_thumbnail() ) {
     							echo'<div class="service-icon">'.get_the_post_thumbnail( $post->ID, 'icon' ).'</div>';
     						}
     						?>
     						<h3 class="service-title"><?php echo esc_attr($page_title); ?></h3>
     					</div>
     					<!-- .service-item -->
     					<article>
     						<?php the_excerpt(); ?>
     					</article>
     					<?php if( !empty( $options[ 'post_excerpt_more_text' ] ) ) { ?>
     					<a class="more-link" title="<?php echo esc_attr($page_title); ?>" href="<?php echo esc_attr($page_permalink); ?>">
     						<?php echo $options[ 'post_excerpt_more_text' ]; ?></a>
     						<?php } ?>
     					</div>
     					<!-- .one-fourth -->
     					<?php $j++; ?>
     					<?php endwhile;
    		 		// Reset Post Data
     					wp_reset_query(); 
     					?>
     				</div>
     				<!-- .column --> 
     				<?php echo $after_widget;
     			}
    

    Hope this may help you
    Thank you!

    #45282
    Mark L
    Participant

    So if you know there is a potential plugin conflict, and my solution fixes the conflict, why would you not implement the solution that I presented eliminating the potential conflict with other users with similar plugins. Adopting the fix seems to be a much better resolution than for me to create a child theme, thus fixing my issue, but all other future users may have the same problem as the code base is not fixed.

    #45297

    Hi Mark L,

    We will fix this issues in upcoming version update. Currently we are busy on new theme. We will update it soon. For now you can make direct code customization.

    Thank you!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.