Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/herald/core/admin/metaboxe...
File: category.php
<?php
[0] Fix | Delete
[1] Fix | Delete
add_action( 'category_add_form_fields', 'herald_category_add_meta_fields', 10, 2 );
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Add category meta
[5] Fix | Delete
*
[6] Fix | Delete
* Callback function to load category meta fields on "new category" screen
[7] Fix | Delete
*
[8] Fix | Delete
* @since 1.0
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
if ( !function_exists( 'herald_category_add_meta_fields' ) ) :
[12] Fix | Delete
function herald_category_add_meta_fields() {
[13] Fix | Delete
$meta = herald_get_category_meta();
[14] Fix | Delete
$options = herald_get_category_meta_options();
[15] Fix | Delete
extract($options);
[16] Fix | Delete
?>
[17] Fix | Delete
[18] Fix | Delete
[19] Fix | Delete
<div class="form-field">
[20] Fix | Delete
<label><?php esc_html_e( 'Featured area', 'herald' ); ?></label>
[21] Fix | Delete
<ul class="herald-img-select-wrap">
[22] Fix | Delete
<?php foreach ( $fa_layouts as $id => $layout ): ?>
[23] Fix | Delete
<li>
[24] Fix | Delete
<?php $selected_class = herald_compare( $meta['fa_layout'], $id ) ? ' selected': ''; ?>
[25] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[26] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[27] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[fa_layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['fa_layout'] );?>/> </label>
[28] Fix | Delete
</li>
[29] Fix | Delete
<?php endforeach; ?>
[30] Fix | Delete
</ul>
[31] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose a featured posts layout for this category', 'herald' ); ?></p>
[32] Fix | Delete
</div>
[33] Fix | Delete
[34] Fix | Delete
<div class="form-field">
[35] Fix | Delete
<label><?php esc_html_e( 'Main layout', 'herald' ); ?></label>
[36] Fix | Delete
<ul class="herald-img-select-wrap herald-next-hide">
[37] Fix | Delete
<?php foreach ( $post_layouts as $id => $layout ): ?>
[38] Fix | Delete
<li>
[39] Fix | Delete
<?php $selected_class = herald_compare( $meta['layout'], $id ) ? ' selected': ''; ?>
[40] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[41] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[42] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['layout'] );?>/> </label>
[43] Fix | Delete
</li>
[44] Fix | Delete
<?php endforeach; ?>
[45] Fix | Delete
</ul>
[46] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose main layout for this category', 'herald' ); ?></p>
[47] Fix | Delete
</div>
[48] Fix | Delete
[49] Fix | Delete
<?php $style = $meta['layout'] == 'inherit' ? 'display:none;' : ''; ?>
[50] Fix | Delete
<div class="form-field" style="<?php echo esc_attr($style); ?>">
[51] Fix | Delete
<label>
[52] Fix | Delete
<?php esc_html_e( 'Posts per page', 'herald' ); ?>
[53] Fix | Delete
</label>
[54] Fix | Delete
<input type="radio" name="herald[ppp]" value="inherit" <?php checked( $meta['ppp'], 'inherit' );?> class="herald-next-hide"> <?php esc_html_e( 'Inherit from global category settings', 'herald' ); ?><br/>
[55] Fix | Delete
<input type="radio" name="herald[ppp]" value="custom" <?php checked( $meta['ppp'], 'custom' );?> class="herald-next-hide"> <?php esc_html_e( 'Set custom number', 'herald' ); ?>
[56] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose how many posts per page you want to display', 'herald' ); ?></p>
[57] Fix | Delete
</div>
[58] Fix | Delete
[59] Fix | Delete
<?php $style = $meta['ppp'] == 'inherit' ? 'display:none;' : ''; ?>
[60] Fix | Delete
<div class="form-field" style="<?php echo esc_attr($style); ?>">
[61] Fix | Delete
<label>
[62] Fix | Delete
<?php esc_html_e( 'Number of posts per page', 'herald' ); ?>
[63] Fix | Delete
</label>
[64] Fix | Delete
<input type="text" class="herald-small-text" name="herald[ppp_num]" value="<?php echo esc_attr($meta['ppp_num']); ?>" /> <?php esc_html_e( 'posts', 'herald' ); ?><br/>
[65] Fix | Delete
</div>
[66] Fix | Delete
[67] Fix | Delete
<?php $style = $meta['layout'] == 'inherit' ? 'display:none;' : ''; ?>
[68] Fix | Delete
<div class="form-field" style="<?php echo esc_attr($style); ?>">
[69] Fix | Delete
<label><?php esc_html_e( 'Number of posts per page', 'herald' ); ?></label>
[70] Fix | Delete
<input type="text" class="herald-small-text" name="herald[ppp]" value="<?php echo esc_attr($meta['ppp']); ?>" /> <?php esc_html_e( 'posts', 'herald' ); ?><br/>
[71] Fix | Delete
<small class="description"><?php esc_html_e( 'Note: leave empty if you want to inherit from global category option', 'herald' ); ?></small>
[72] Fix | Delete
</div>
[73] Fix | Delete
[74] Fix | Delete
<div class="form-field">
[75] Fix | Delete
<label><?php esc_html_e( 'Starter layout', 'herald' ); ?></label>
[76] Fix | Delete
<ul class="herald-img-select-wrap herald-next-hide">
[77] Fix | Delete
<?php foreach ( $starter_layouts as $id => $layout ): ?>
[78] Fix | Delete
<li>
[79] Fix | Delete
<?php $selected_class = herald_compare( $meta['starter_layout'], $id ) ? ' selected': ''; ?>
[80] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[81] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[82] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[starter_layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['starter_layout'] );?>/> </label>
[83] Fix | Delete
</li>
[84] Fix | Delete
<?php endforeach; ?>
[85] Fix | Delete
</ul>
[86] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose starter layout for this category', 'herald' ); ?></p>
[87] Fix | Delete
</div>
[88] Fix | Delete
[89] Fix | Delete
<?php $style = $meta['starter_layout'] == 'inherit' ? 'display:none;' : ''; ?>
[90] Fix | Delete
<div class="form-field" style="<?php echo esc_attr($style); ?>">
[91] Fix | Delete
<label><?php esc_html_e( 'Number of starter posts', 'herald' ); ?></label>
[92] Fix | Delete
<input type="text" class="herald-small-text" name="herald[starter_limit]" value="<?php echo esc_attr( $meta['starter_limit']); ?>"/>
[93] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose number of post to display in starter layout', 'herald' ); ?></p>
[94] Fix | Delete
</div>
[95] Fix | Delete
[96] Fix | Delete
<div class="form-field">
[97] Fix | Delete
<label><?php esc_html_e( 'Display sidebar', 'herald' ); ?></label>
[98] Fix | Delete
<ul class="herald-img-select-wrap">
[99] Fix | Delete
<?php foreach ( $sidebars_layouts as $id => $layout ): ?>
[100] Fix | Delete
<li>
[101] Fix | Delete
<?php $selected_class = herald_compare( $meta['use_sidebar'], $id ) ? ' selected': ''; ?>
[102] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[103] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[104] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[use_sidebar]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['use_sidebar'] );?>/> </label>
[105] Fix | Delete
</li>
[106] Fix | Delete
<?php endforeach; ?>
[107] Fix | Delete
</ul>
[108] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose sidebar layout', 'herald' ); ?></p>
[109] Fix | Delete
</div>
[110] Fix | Delete
[111] Fix | Delete
<?php if ( !empty( $sidebars ) ): ?>
[112] Fix | Delete
<div class="form-field">
[113] Fix | Delete
<label><?php esc_html_e( 'Standard sidebar', 'herald' ); ?></label>
[114] Fix | Delete
<select name="herald[sidebar]">
[115] Fix | Delete
<?php foreach ( $sidebars as $id => $name ): ?>
[116] Fix | Delete
<option value="<?php echo esc_attr($id); ?>" <?php selected( $id, $meta['sidebar'] );?>><?php echo esc_html( $name ); ?></option>
[117] Fix | Delete
<?php endforeach; ?>
[118] Fix | Delete
</select>
[119] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose standard sidebar to display', 'herald' ); ?></p>
[120] Fix | Delete
</div>
[121] Fix | Delete
<div class="form-field">
[122] Fix | Delete
<label><?php esc_html_e( 'Sticky sidebar', 'herald' ); ?></label>
[123] Fix | Delete
<select name="herald[sticky_sidebar]">
[124] Fix | Delete
<?php foreach ( $sidebars as $id => $name ): ?>
[125] Fix | Delete
<option value="<?php echo esc_attr($id); ?>" <?php selected( $id, $meta['sticky_sidebar'] );?>><?php echo esc_html( $name ); ?></option>
[126] Fix | Delete
<?php endforeach; ?>
[127] Fix | Delete
</select>
[128] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose sticky sidebar to display', 'herald' ); ?></p>
[129] Fix | Delete
</div>
[130] Fix | Delete
<?php endif; ?>
[131] Fix | Delete
[132] Fix | Delete
<div class="form-field">
[133] Fix | Delete
<label><?php esc_html_e( 'Pagination', 'herald' ); ?></label>
[134] Fix | Delete
<ul class="herald-img-select-wrap">
[135] Fix | Delete
<?php foreach ( $pag_layouts as $id => $layout ): ?>
[136] Fix | Delete
<li>
[137] Fix | Delete
<?php $selected_class = herald_compare( $meta['pag'], $id ) ? ' selected': ''; ?>
[138] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[139] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[140] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[pag]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['pag'] );?>/> </label>
[141] Fix | Delete
</li>
[142] Fix | Delete
<?php endforeach; ?>
[143] Fix | Delete
</ul>
[144] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose pagination type', 'herald' ); ?></p>
[145] Fix | Delete
</div>
[146] Fix | Delete
[147] Fix | Delete
<div class="form-field">
[148] Fix | Delete
<label><?php esc_html_e( 'Color', 'herald' ); ?></label>
[149] Fix | Delete
<input type="radio" name="herald[color_type]" value="inherit" class="herald-radio color-type" <?php checked( $meta['color_type'], 'inherit' );?>> <?php esc_html_e( 'Inherit from accent color', 'herald' ); ?><br/>
[150] Fix | Delete
<input type="radio" name="herald[color_type]" value="custom" class="herald-radio color-type" <?php checked( $meta['color_type'], 'custom' );?>> <?php esc_html_e( 'Set custom color', 'herald' ); ?>
[151] Fix | Delete
<div id="herald-color-wrap">
[152] Fix | Delete
<p>
[153] Fix | Delete
<input name="herald[color]" type="text" class="herald-colorpicker" value="<?php echo esc_attr($meta['color']); ?>" data-default-color="<?php echo esc_attr($meta['color']); ?>"/>
[154] Fix | Delete
</p>
[155] Fix | Delete
<?php $recent_colors = get_option( 'herald_recent_cat_colors' ); ?>
[156] Fix | Delete
<?php if(!empty($recent_colors)) : ?>
[157] Fix | Delete
<p><?php esc_html_e( 'Recently used', 'herald' ); ?>:<br/>
[158] Fix | Delete
<?php foreach($recent_colors as $color) : ?>
[159] Fix | Delete
<a href="javascript:void(0)" style="background: <?php echo esc_attr($color); ?>;" class="herald-rec-color" data-color="<?php echo esc_attr($color); ?>"></a>
[160] Fix | Delete
<?php endforeach; ?>
[161] Fix | Delete
</p>
[162] Fix | Delete
<?php endif; ?>
[163] Fix | Delete
</div><br/>
[164] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose a color', 'herald' ); ?></p>
[165] Fix | Delete
</div>
[166] Fix | Delete
[167] Fix | Delete
<div class="form-field">
[168] Fix | Delete
<label><?php esc_html_e( 'Image', 'herald' ); ?></label>
[169] Fix | Delete
<?php $display = $meta['image'] ? 'initial' : 'none'; ?>
[170] Fix | Delete
<p>
[171] Fix | Delete
<img id="herald-image-preview" src="<?php echo esc_url( $meta['image'] ); ?>" style="display:<?php echo esc_attr( $display ); ?>;">
[172] Fix | Delete
</p>
[173] Fix | Delete
[174] Fix | Delete
<p>
[175] Fix | Delete
<input type="hidden" name="herald[image]" id="herald-image-url" value="<?php echo esc_attr( $meta['image'] ); ?>"/>
[176] Fix | Delete
<input type="button" id="herald-image-upload" class="button-secondary" value="<?php esc_attr_e( 'Upload', 'herald' ); ?>"/>
[177] Fix | Delete
<input type="button" id="herald-image-clear" class="button-secondary" value="<?php esc_attr_e( 'Clear', 'herald' ); ?>" style="display:<?php echo esc_attr( $display ); ?>"/>
[178] Fix | Delete
</p>
[179] Fix | Delete
[180] Fix | Delete
<p class="description"><?php esc_html_e( 'Upload an image for this category', 'herald' ); ?></p>
[181] Fix | Delete
</div>
[182] Fix | Delete
[183] Fix | Delete
<?php
[184] Fix | Delete
}
[185] Fix | Delete
endif;
[186] Fix | Delete
[187] Fix | Delete
[188] Fix | Delete
add_action( 'category_edit_form_fields', 'herald_category_edit_meta_fields', 10, 2 );
[189] Fix | Delete
[190] Fix | Delete
/**
[191] Fix | Delete
* Edit category meta
[192] Fix | Delete
*
[193] Fix | Delete
* Callback function to load category meta fields on edit screen
[194] Fix | Delete
*
[195] Fix | Delete
* @since 1.0
[196] Fix | Delete
*/
[197] Fix | Delete
[198] Fix | Delete
if ( !function_exists( 'herald_category_edit_meta_fields' ) ) :
[199] Fix | Delete
function herald_category_edit_meta_fields( $term ) {
[200] Fix | Delete
$meta = herald_get_category_meta( $term->term_id );
[201] Fix | Delete
$options = herald_get_category_meta_options();
[202] Fix | Delete
extract($options);
[203] Fix | Delete
?>
[204] Fix | Delete
[205] Fix | Delete
<tr class="form-field">
[206] Fix | Delete
<th scope="row" valign="top">
[207] Fix | Delete
<?php esc_html_e( 'Featured area', 'herald' ); ?></label>
[208] Fix | Delete
</th>
[209] Fix | Delete
<td>
[210] Fix | Delete
<ul class="herald-img-select-wrap">
[211] Fix | Delete
<?php foreach ( $fa_layouts as $id => $layout ): ?>
[212] Fix | Delete
<li>
[213] Fix | Delete
<?php $selected_class = herald_compare( $meta['fa_layout'], $id ) ? ' selected': ''; ?>
[214] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[215] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[216] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[fa_layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['fa_layout'] );?>/> </label>
[217] Fix | Delete
</li>
[218] Fix | Delete
<?php endforeach; ?>
[219] Fix | Delete
</ul>
[220] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose a featured posts layout for this category', 'herald' ); ?></p>
[221] Fix | Delete
</td>
[222] Fix | Delete
</tr>
[223] Fix | Delete
[224] Fix | Delete
<tr class="form-field">
[225] Fix | Delete
<th scope="row" valign="top">
[226] Fix | Delete
<label><?php esc_html_e( 'Posts main layout', 'herald' ); ?></label>
[227] Fix | Delete
</th>
[228] Fix | Delete
<td>
[229] Fix | Delete
<ul class="herald-img-select-wrap herald-next-hide">
[230] Fix | Delete
<?php foreach ( $post_layouts as $id => $layout ): ?>
[231] Fix | Delete
<li>
[232] Fix | Delete
<?php $selected_class = herald_compare( $meta['layout'], $id ) ? ' selected': ''; ?>
[233] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[234] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[235] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['layout'] );?>/> </label>
[236] Fix | Delete
</li>
[237] Fix | Delete
<?php endforeach; ?>
[238] Fix | Delete
</ul>
[239] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose posts layout for this category', 'herald' ); ?></p>
[240] Fix | Delete
</td>
[241] Fix | Delete
</tr>
[242] Fix | Delete
[243] Fix | Delete
<?php $style = $meta['layout'] == 'inherit' ? 'display:none;' : ''; ?>
[244] Fix | Delete
<tr class="form-field" style="<?php echo esc_attr($style); ?>">
[245] Fix | Delete
<th>
[246] Fix | Delete
<?php esc_html_e( 'Posts per page', 'herald' ); ?>
[247] Fix | Delete
</th>
[248] Fix | Delete
<td>
[249] Fix | Delete
<input type="radio" name="herald[ppp]" value="inherit" <?php checked( $meta['ppp'], 'inherit' );?> class="herald-next-hide"> <?php esc_html_e( 'Inherit from global category settings', 'herald' ); ?><br/>
[250] Fix | Delete
<input type="radio" name="herald[ppp]" value="custom" <?php checked( $meta['ppp'], 'custom' );?> class="herald-next-hide"> <?php esc_html_e( 'Set custom number', 'herald' ); ?>
[251] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose how many posts per page you want to display', 'herald' ); ?></p>
[252] Fix | Delete
</td>
[253] Fix | Delete
</tr>
[254] Fix | Delete
[255] Fix | Delete
<?php $style = $meta['ppp'] == 'inherit' ? 'display:none;' : ''; ?>
[256] Fix | Delete
<tr class="form-field" style="<?php echo esc_attr($style); ?>">
[257] Fix | Delete
<th>
[258] Fix | Delete
<?php esc_html_e( 'Number of posts per page', 'herald' ); ?>
[259] Fix | Delete
</th>
[260] Fix | Delete
<td>
[261] Fix | Delete
<input type="text" class="herald-small-text" name="herald[ppp_num]" value="<?php echo esc_attr($meta['ppp_num']); ?>"/> <?php esc_html_e( 'posts', 'herald' ); ?><br/>
[262] Fix | Delete
</td>
[263] Fix | Delete
</tr>
[264] Fix | Delete
[265] Fix | Delete
[266] Fix | Delete
<tr class="form-field">
[267] Fix | Delete
<th scope="row" valign="top">
[268] Fix | Delete
<label><?php esc_html_e( 'Starter layout', 'herald' ); ?></label>
[269] Fix | Delete
</th>
[270] Fix | Delete
<td>
[271] Fix | Delete
<ul class="herald-img-select-wrap herald-next-hide">
[272] Fix | Delete
<?php foreach ( $starter_layouts as $id => $layout ): ?>
[273] Fix | Delete
<li>
[274] Fix | Delete
<?php $selected_class = herald_compare( $meta['starter_layout'], $id ) ? ' selected': ''; ?>
[275] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[276] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[277] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[starter_layout]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['starter_layout'] );?>/> </label>
[278] Fix | Delete
</li>
[279] Fix | Delete
<?php endforeach; ?>
[280] Fix | Delete
</ul>
[281] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose starter layout for this category', 'herald' ); ?></p>
[282] Fix | Delete
</td>
[283] Fix | Delete
</tr>
[284] Fix | Delete
[285] Fix | Delete
<?php $style = $meta['starter_layout'] == 'inherit' ? 'display:none;' : ''; ?>
[286] Fix | Delete
<tr class="form-field" style="<?php echo esc_attr($style); ?>">
[287] Fix | Delete
<th scope="row" valign="top">
[288] Fix | Delete
<label><?php esc_html_e( 'Number of starter posts', 'herald' ); ?></label>
[289] Fix | Delete
</th>
[290] Fix | Delete
<td>
[291] Fix | Delete
<input type="text" class="herald-small-text" name="herald[starter_limit]" value="<?php echo esc_attr( $meta['starter_limit']); ?>"/>
[292] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose number of post to display in starter layout', 'herald' ); ?></p>
[293] Fix | Delete
</td>
[294] Fix | Delete
</tr>
[295] Fix | Delete
[296] Fix | Delete
<tr class="form-field">
[297] Fix | Delete
<th scope="row" valign="top">
[298] Fix | Delete
<label><?php esc_html_e( 'Display sidebar', 'herald' ); ?></label>
[299] Fix | Delete
</th>
[300] Fix | Delete
<td>
[301] Fix | Delete
<ul class="herald-img-select-wrap">
[302] Fix | Delete
<?php foreach ( $sidebars_layouts as $id => $layout ): ?>
[303] Fix | Delete
<li>
[304] Fix | Delete
<?php $selected_class = herald_compare( $meta['use_sidebar'], $id ) ? ' selected': ''; ?>
[305] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[306] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[307] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[use_sidebar]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['use_sidebar'] );?>/> </label>
[308] Fix | Delete
</li>
[309] Fix | Delete
<?php endforeach; ?>
[310] Fix | Delete
</ul>
[311] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose sidebar layout', 'herald' ); ?></p>
[312] Fix | Delete
</td>
[313] Fix | Delete
</tr>
[314] Fix | Delete
[315] Fix | Delete
<tr class="form-field">
[316] Fix | Delete
<th scope="row" valign="top">
[317] Fix | Delete
<label><?php esc_html_e( 'Standard sidebar', 'herald' ); ?></label>
[318] Fix | Delete
</th>
[319] Fix | Delete
<td>
[320] Fix | Delete
<select name="herald[sidebar]">
[321] Fix | Delete
<?php foreach ( $sidebars as $id => $name ): ?>
[322] Fix | Delete
<option value="<?php echo esc_attr($id); ?>" <?php selected( $id, $meta['sidebar'] );?>><?php echo esc_html( $name ); ?></option>
[323] Fix | Delete
<?php endforeach; ?>
[324] Fix | Delete
</select>
[325] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose standard sidebar to display', 'herald' ); ?></p>
[326] Fix | Delete
</td>
[327] Fix | Delete
</tr>
[328] Fix | Delete
<tr class="form-field">
[329] Fix | Delete
<th scope="row" valign="top">
[330] Fix | Delete
<label><?php esc_html_e( 'Sticky sidebar', 'herald' ); ?></label>
[331] Fix | Delete
</th>
[332] Fix | Delete
<td>
[333] Fix | Delete
<select name="herald[sticky_sidebar]">
[334] Fix | Delete
<?php foreach ( $sidebars as $id => $name ): ?>
[335] Fix | Delete
<option value="<?php echo esc_attr($id); ?>" <?php selected( $id, $meta['sticky_sidebar'] );?>><?php echo esc_html( $name ); ?></option>
[336] Fix | Delete
<?php endforeach; ?>
[337] Fix | Delete
</select>
[338] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose sticky sidebar to display', 'herald' ); ?></p>
[339] Fix | Delete
</td>
[340] Fix | Delete
</tr>
[341] Fix | Delete
[342] Fix | Delete
<tr class="form-field">
[343] Fix | Delete
<th scope="row" valign="top">
[344] Fix | Delete
<label><?php esc_html_e( 'Pagination', 'herald' ); ?></label>
[345] Fix | Delete
</th>
[346] Fix | Delete
<td>
[347] Fix | Delete
<ul class="herald-img-select-wrap">
[348] Fix | Delete
<?php foreach ( $pag_layouts as $id => $layout ): ?>
[349] Fix | Delete
<li>
[350] Fix | Delete
<?php $selected_class = herald_compare( $meta['pag'], $id ) ? ' selected': ''; ?>
[351] Fix | Delete
<img src="<?php echo esc_url($layout['img']); ?>" title="<?php echo esc_attr($layout['title']); ?>" class="herald-img-select<?php echo esc_attr($selected_class); ?>">
[352] Fix | Delete
<span><?php echo esc_html( $layout['title'] ); ?></span>
[353] Fix | Delete
<input type="radio" class="herald-hidden" name="herald[pag]" value="<?php echo esc_attr($id); ?>" <?php checked( $id, $meta['pag'] );?>/> </label>
[354] Fix | Delete
</li>
[355] Fix | Delete
<?php endforeach; ?>
[356] Fix | Delete
</ul>
[357] Fix | Delete
<p class="description"><?php esc_html_e( 'Choose pagination type', 'herald' ); ?></p>
[358] Fix | Delete
</td>
[359] Fix | Delete
</tr>
[360] Fix | Delete
[361] Fix | Delete
<tr class="form-field">
[362] Fix | Delete
<th scope="row" valign="top"><label><?php esc_html_e( 'Color', 'herald' ); ?></label></th>
[363] Fix | Delete
<td>
[364] Fix | Delete
<label><input type="radio" name="herald[color_type]" value="inherit" class="herald-radio color-type" <?php checked( $meta['color_type'], 'inherit' );?>> <?php esc_html_e( 'Inherit from accent color', 'herald' ); ?></label> <br/>
[365] Fix | Delete
<label><input type="radio" name="herald[color_type]" value="custom" class="herald-radio color-type" <?php checked( $meta['color_type'], 'custom' );?>> <?php esc_html_e( 'Set custom color', 'herald' ); ?></label>
[366] Fix | Delete
<div id="herald-color-wrap">
[367] Fix | Delete
<p>
[368] Fix | Delete
<input name="herald[color]" type="text" class="herald-colorpicker" value="<?php echo esc_attr($meta['color']); ?>" data-default-color="<?php echo esc_attr($meta['color']); ?>"/>
[369] Fix | Delete
</p>
[370] Fix | Delete
[371] Fix | Delete
<?php $recent_colors = get_option( 'herald_recent_cat_colors' ); ?>
[372] Fix | Delete
<?php if(!empty($recent_colors)) : ?>
[373] Fix | Delete
<p class="description"><?php esc_html_e( 'Recently used', 'herald' ); ?>:<br/>
[374] Fix | Delete
<?php foreach($recent_colors as $color) : ?>
[375] Fix | Delete
<a href="javascript:void(0)" style="background: <?php echo esc_attr($color); ?>;" class="herald-rec-color" data-color="<?php echo esc_attr($color); ?>"></a>
[376] Fix | Delete
<?php endforeach; ?>
[377] Fix | Delete
</p>
[378] Fix | Delete
[379] Fix | Delete
<?php endif; ?>
[380] Fix | Delete
</div>
[381] Fix | Delete
</td>
[382] Fix | Delete
</tr>
[383] Fix | Delete
[384] Fix | Delete
<tr class="form-field">
[385] Fix | Delete
<th scope="row" valign="top"><label><?php esc_html_e( 'Image', 'herald' ); ?></label></th>
[386] Fix | Delete
<?php $display = $meta['image'] ? 'initial' : 'none'; ?>
[387] Fix | Delete
<td>
[388] Fix | Delete
<p>
[389] Fix | Delete
<img id="herald-image-preview" src="<?php echo esc_url( $meta['image'] ); ?>" style="display:<?php echo esc_attr( $display ); ?>;">
[390] Fix | Delete
</p>
[391] Fix | Delete
[392] Fix | Delete
<p>
[393] Fix | Delete
<input type="hidden" name="herald[image]" id="herald-image-url" value="<?php echo esc_attr( $meta['image'] ); ?>"/>
[394] Fix | Delete
<input type="button" id="herald-image-upload" class="button-secondary" value="<?php esc_attr_e( 'Upload', 'herald' ); ?>"/>
[395] Fix | Delete
<input type="button" id="herald-image-clear" class="button-secondary" value="<?php esc_attr_e( 'Clear', 'herald' ); ?>" style="display:<?php echo esc_attr( $display ); ?>"/>
[396] Fix | Delete
</p>
[397] Fix | Delete
[398] Fix | Delete
<p class="description"><?php esc_html_e( 'Upload an image for this category', 'herald' ); ?></p>
[399] Fix | Delete
</td>
[400] Fix | Delete
</tr>
[401] Fix | Delete
[402] Fix | Delete
<?php
[403] Fix | Delete
}
[404] Fix | Delete
endif;
[405] Fix | Delete
[406] Fix | Delete
[407] Fix | Delete
add_action( 'edited_category', 'herald_save_category_meta_fields', 10, 2 );
[408] Fix | Delete
add_action( 'create_category', 'herald_save_category_meta_fields', 10, 2 );
[409] Fix | Delete
[410] Fix | Delete
/**
[411] Fix | Delete
* Save category meta
[412] Fix | Delete
*
[413] Fix | Delete
* Callback function to save category meta data
[414] Fix | Delete
*
[415] Fix | Delete
* @since 1.0
[416] Fix | Delete
*/
[417] Fix | Delete
[418] Fix | Delete
if ( !function_exists( 'herald_save_category_meta_fields' ) ) :
[419] Fix | Delete
function herald_save_category_meta_fields( $term_id ) {
[420] Fix | Delete
[421] Fix | Delete
if ( isset( $_POST['herald'] ) ) {
[422] Fix | Delete
[423] Fix | Delete
$meta = array();
[424] Fix | Delete
[425] Fix | Delete
if( isset( $_POST['herald']['layout'] ) && $_POST['herald']['layout'] != 'inherit' ){
[426] Fix | Delete
$meta['layout'] = $_POST['herald']['layout'];
[427] Fix | Delete
}
[428] Fix | Delete
[429] Fix | Delete
if( isset( $_POST['herald']['starter_layout'] ) && $_POST['herald']['starter_layout'] != 'inherit' ){
[430] Fix | Delete
$meta['starter_layout'] = $_POST['herald']['starter_layout'];
[431] Fix | Delete
$meta['starter_limit'] = absint($_POST['herald']['starter_limit']);
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
if( isset( $_POST['herald']['fa_layout'] ) && $_POST['herald']['fa_layout'] != 'inherit' ){
[435] Fix | Delete
$meta['fa_layout'] = $_POST['herald']['fa_layout'];
[436] Fix | Delete
}
[437] Fix | Delete
[438] Fix | Delete
if( isset( $_POST['herald']['use_sidebar'] ) && $_POST['herald']['use_sidebar'] != 'inherit' ){
[439] Fix | Delete
$meta['use_sidebar'] = $_POST['herald']['use_sidebar'];
[440] Fix | Delete
}
[441] Fix | Delete
[442] Fix | Delete
if( isset( $_POST['herald']['sidebar'] ) && $_POST['herald']['sidebar'] != 'inherit' ){
[443] Fix | Delete
$meta['sidebar'] = $_POST['herald']['sidebar'];
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
if( isset( $_POST['herald']['sticky_sidebar'] ) && $_POST['herald']['sticky_sidebar'] != 'inherit' ){
[447] Fix | Delete
$meta['sticky_sidebar'] = $_POST['herald']['sticky_sidebar'];
[448] Fix | Delete
}
[449] Fix | Delete
[450] Fix | Delete
if( isset( $_POST['herald']['pag'] ) && $_POST['herald']['pag'] != 'inherit' ){
[451] Fix | Delete
$meta['pag'] = $_POST['herald']['pag'];
[452] Fix | Delete
}
[453] Fix | Delete
[454] Fix | Delete
if( isset( $_POST['herald']['ppp'] ) && $_POST['herald']['ppp'] != 'inherit'){
[455] Fix | Delete
$meta['ppp'] = $_POST['herald']['ppp'];
[456] Fix | Delete
$meta['ppp_num'] = absint($_POST['herald']['ppp_num']);
[457] Fix | Delete
}
[458] Fix | Delete
[459] Fix | Delete
if( isset( $_POST['herald']['color_type'] ) ) {
[460] Fix | Delete
if( $_POST['herald']['color_type'] != 'inherit' ){
[461] Fix | Delete
$meta['color_type'] = $_POST['herald']['color_type'];
[462] Fix | Delete
$meta['color'] = $_POST['herald']['color'];
[463] Fix | Delete
}
[464] Fix | Delete
[465] Fix | Delete
herald_update_cat_colors( $term_id, $_POST['herald']['color'], $_POST['herald']['color_type'] );
[466] Fix | Delete
}
[467] Fix | Delete
[468] Fix | Delete
if ( isset( $_POST['herald']['image'] ) ) {
[469] Fix | Delete
$meta['image'] = $_POST['herald']['image'];
[470] Fix | Delete
}
[471] Fix | Delete
[472] Fix | Delete
[473] Fix | Delete
if(!empty($meta)){
[474] Fix | Delete
update_option( '_herald_category_'.$term_id, $meta );
[475] Fix | Delete
} else {
[476] Fix | Delete
delete_option( '_herald_category_'.$term_id );
[477] Fix | Delete
}
[478] Fix | Delete
[479] Fix | Delete
}
[480] Fix | Delete
[481] Fix | Delete
}
[482] Fix | Delete
endif;
[483] Fix | Delete
[484] Fix | Delete
/**
[485] Fix | Delete
* Update category colors
[486] Fix | Delete
*
[487] Fix | Delete
* Function checks for category color and updates two fields
[488] Fix | Delete
* in options table. One for list of category colors and second
[489] Fix | Delete
* for recently picked colors.
[490] Fix | Delete
*
[491] Fix | Delete
* @param int $cat_id
[492] Fix | Delete
* @param string $color Hexadecimal color value
[493] Fix | Delete
* @param string $type inherit|custom
[494] Fix | Delete
* @return void
[495] Fix | Delete
* @since 1.0
[496] Fix | Delete
*/
[497] Fix | Delete
if ( !function_exists( 'herald_update_cat_colors' ) ):
[498] Fix | Delete
function herald_update_cat_colors( $cat_id, $color, $type ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function