我下面有所有这些选项,并且所有这些选项在Wordpress 5+之前都可以使用,那么如何自动将所有图像链接到媒体文件? :(
我管理着一个(多作者)博客,我们所有的用户都上传了一些图片,但他们不知道(附件,媒体文件,自定义网址或没有)之间的区别,我找到了隐藏链接面板的解决方案,但是我编辑所有已发布的帖子以手动更改图像链接!! :(
请帮忙。
<div id="headerErrorBox" style="display: none;">Error!</div>
<div id="dob_success_msg" style="display: none;">Success!</div>
<select name="dob_day" onchange="return dobvalidation()" id="dob_input1" class="frmSelect" autocomplete="off" style="width: 30%;">
<option>DD</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">so on.. to 30</option>
</select>
<select name="dob_mm" onchange="return dobvalidation()" id="dob_input2" class="frmSelect" autocomplete="off" style="width: 25%">
<option>MM</option>
<option value="January">January</option>
<option value="Febuary">Febuary</option>
<option value="March">so on. untill dec</option>
</select>
<select name="dob_day" onchange="return dobvalidation()" id="dob_input3" class="frmSelect" autocomplete="off" style="width: 30%;">
<option value="">YY</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
</select>
function amethyst_gallery_atts( $out, $pairs, $atts ) {
$atts = shortcode_atts( array(
'columns' => '2',
'size' => 'medium',
'link' => 'file',
), $atts );
$out['columns'] = $atts['columns'];
$out['size'] = $atts['size'];
$out['link'] = $atts['link'];
return $out;
}
add_filter( 'shortcode_atts_gallery', 'amethyst_gallery_atts', 10, 3 );
add_filter( 'shortcode_atts_gallery',
function( $out ){
$out['link'] = 'file';
return $out;
}
);
function my_gallery_default_type_set_link( $settings ) {
$settings['galleryDefaults']['link'] = 'file';
return $settings;
}
add_filter( 'media_view_settings', 'my_gallery_default_type_set_link');