Add field to post form

If you’re comfortable writing plugins, you can use “meta boxes” to add custom meta fields to the post form. Please have a look at the add_meta_box examples to see what I mean. The general idea is that you add a meta box containing a field, and save it to the meta table when the form … Read more

Custom Link In WordPress Media “Attachment Details” Upload Screen

A hacky way to do it is to do a string replace on the tmpl-attachment-details template: // See wp_print_media_templates() in “wp-includes/media-template.php” function wpse157297_print_media_templates() { $my_link = ‘<a class=”my_link-attachment” href=”https://wordpress.stackexchange.com/questions/157297/my_link.php?url={{ data.url }}” target=”_blank”>’ . __( ‘My Link’ ) . ‘</a>’; $nonimage=”<# if ( “image” !== data.type && ! data.uploading ) { #>” . $my_link . ‘<# … Read more

Add category slug as class attribute in a link array

Ok guys found the solution myself (5 days later, oof) added below to help someone else in the future… foreach((get_the_category( $related_post->ID )) as $category) { $output .= “<a class=\”$category->slug\” href=\””.get_permalink( $related_post->ID ).”\” title=\”” . $category->cat_name . “\”>” . $category->cat_name . “</a>”; } Basically the old link above looked like this… $output .= “<a href=\””.get_permalink( $related_post->ID … Read more