Tag Info

New answers tagged

1

You can't write this syntax directly to plain HTML code. ::berfore element is added to HTML tag only when it is defined in CSS stylesheet (like denis.stoyanov wrote).


1

Why do you need to manually enter it? The ::before and ::after are there even without declaration. li::before { some rules... } li::after { some rules... } Here is an article that describes it.


0

Firstly it is best to not edit your wordpress core files inside wp-admin but rather modify them with filters/actions and hooks. Check the wordpress codex to see all the filters you could use. Here is the code for a filter that you can put into your theme functions file (/wp-content/themes/{the-theme-you-are-using}/functions.php) to make the view post use ...


1

Here's a shorter way to do it (PHP 5.4+): add_filter( 'media_send_to_editor', function( $html, $send_id, $attachment ) { $class = wp_check_filetype( $attachment['url'] )['ext']; return str_ireplace( '<a href', sprintf( '<a class="%s" href',$class ? $class : 'unknown' ), $html ); }, 10, 3 ); where we get the attachment's info from the third input ...


2

So thanks to @amritanshu and @wycks github's code, here is the solution for those in need to add a class with the media type to the attachment url before it gets inserted in the editor : if ( ! function_exists( 'epc_add_class_pdf' ) ) : function epc_add_class_pdf( $html, $id ) { $attachment = get_post( $id ); $mime_type = ...


1

This is not the answer but just the hint. media_send_to_editor should be the hook that should help you. Not sure how but came across this while searching for my problem I would have commented but still 4 points short, so unable to comment All the best



Top 50 recent answers are included