I don’t know what in detail causes this effect. It cost me some time to find out this plugin was the cause because I checked everything else first because I didn’t expect a plugin that takes care of such a relatively small detail could have such a big effect.
]]>Please help!
]]>But the widget prints an number at the end.
This is my code :
class text_image_widget extends WP_Widget {
function __construct() {
parent::__construct(
'custom-widget', // Base ID
__( 'custom-widget', 'text_domain' ), // Name
array( 'description' => __( 'custom-widget', 'text_domain' ), ) // Args
);
add_action('admin_enqueue_scripts', array($this, 'upload_scripts'));
}
/**
* Upload the Javascripts for the media uploader
*/
public function upload_scripts()
{
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script('upload_media_widget', plugin_dir_url(__FILE__) . 'upload-media.js', array('jquery'));
wp_enqueue_style('thickbox');
}
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget( $args, $instance ) {
?>
<img src="<?= $instance['image'] ?>" alt="" class="img-responsive center-block">
<h3><?= $instance['title']?></h3>
<p>
<?= $instance['body'] ?>
</p>
<a href="<?= $instance['link']?>" class="btn btn-white-border">
Lees meer
</a>
<?php
}
/**
* Back-end widget form.
*
* @see WP_Widget::form()
*
* @param array $instance Previously saved values from database.
*/
public function form( $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'New title', 'text_domain' );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( esc_attr( 'Title:' ) ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
</p>
<?php
$body = ! empty( $instance['body'] ) ? $instance['body'] : __( 'New body', 'text_domain' );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'body' ) ); ?>"><?php _e( esc_attr( 'Body:' ) ); ?></label>
<textarea class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'body' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'body' ) ); ?>" rows="10"><?php echo esc_attr( $body ); ?></textarea>
</p>
<?php
$image = '';
if(isset($instance['image']))
{
$image = $instance['image'];
}
?>
<p>
<label for="<?php echo $this->get_field_name( 'image' ); ?>"><?php _e( 'Image:' ); ?></label>
<input name="<?php echo $this->get_field_name( 'image' ); ?>" id="<?php echo $this->get_field_id( 'image' ); ?>" class="widefat" type="text" size="36" value="<?php echo esc_url( $image ); ?>" />
<input class="upload_image_button button button-primary" type="button" value="Upload Image" />
</p>
<?php
$link = ! empty( $instance['link'] ) ? $instance['link'] : __( 'New link', 'text_domain' );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'link' ) ); ?>"><?php _e( esc_attr( 'Lees meer link:' ) ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'link' ) ); ?>" type="text" value="<?php echo esc_attr( $link ); ?>">
</p>
<?php
}
/**
* Sanitize widget form values as they are saved.
*
* @see WP_Widget::update()
*
* @param array $new_instance Values just sent to be saved.
* @param array $old_instance Previously saved values from database.
*
* @return array Updated safe values to be saved.
*/
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
$instance['body'] = ( ! empty( $new_instance['body'] ) ) ? strip_tags( $new_instance['body'] ) : '';
$instance['image'] = ( ! empty( $new_instance['image'] ) ) ? strip_tags( $new_instance['image'] ) : '';
$instance['link'] = ( ! empty( $new_instance['link'] ) ) ? strip_tags( $new_instance['link'] ) : '';
return $instance;
}
Where i call it:
<article class="services services-1">
<?= dynamic_sidebar('dienst1')?>
</article>
What it prints:
<article class="services services-1">
<img src="https://localhost:8888/-----/wordpress/wp-content/uploads/2016/08/message.png" alt="" class="img-responsive center-block">
<h3>Cursus</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras congue, metus non tincidunt ullamcorper, dolor liberdso egestas augue, vel placerat lectus nisi in sapien. </p>
<a href="https://localhost:8888/-------------/wordpress/voorbeeld-pagina/" class="btn btn-white-border">
Lees meer
</a>
1 </article>
]]>I have encountered a insanely weird issue with WordPress. I’m running to identical wordpress – a development and a production enviorment.
The issue is when I want to view a custom taxonomy archive as a RSS feed, it redirects to the rewrite-slug of the connected custom post-type. You with me so far?
Check this out.
—–
Working link on my DEV:
https://pixel-tv.morten.dev.favola.dk/program/pixel-tv-extra/feed/
NOT working link on production version:
https://www.pixel.tv/program/pixel-tv-extra/feed/
—–
As you can see, both the URL’s are the same – excerpt the domain.
And to make everything even more weird, it’s ONLY when I want to see the custom taxonomy archive as a feed.
—–
Non-feed version of custom taxonomy on my DEV:
https://pixel-tv.morten.dev.favola.dk/program/pixel-tv-extra/
Non-feed version of custom taxonomy on production version:
https://www.pixel.tv/program/pixel-tv-extra/
—–
I’m tried and debug the WP_Rewrite array on both DEV and Production and ran it through a text-comparsing which come back as identical. So the rewrite structure is completely the same on both enviorments.
I really, really, really hope some of you can help me. Or even have an idea where I can look a possible solution up.
And as a late comment: I know the content on both links is not the same. Obviously both versions runs on two seperate databases. But the code is 110% identical, since everything is deployed via. the same Git repository
A million thanks in advance.
Regards,
Morten / DuGi
Here’s a print-screen to how it looks and under it a link to the site:
image: https://dl.dropbox.com/u/10298919/wierd_code.png
site: https://skaneventilation.se
Also, for the life of me I can’t decide how many posts to allow on the first page. Since the length varies quite a bit, I have been vacillating between 5 and 10… As of this writing I have it set at 8. Is my ad placement annoying?
]]>