What’s the best way to trim content from WYSIWYG editor?

I have done an excessive amount of googling and haven’t found exactly what I need yet. The client uses the editor (WYSIWYG) to create posts. She adds photos, links to external photos, videos, embeds external videos, and all other formatting. But she does not use the tag nor the excerpt field. When I use wp_trim_words() I get mixed results. Posts with local videos leak markup onto the page A couple posts are only images so there isn’t any content at all Posts with a lot of formatting look really wonky…

Upload file could not be moved to wp-content/uploads

I know it has been asked over and over again on the internet and i spend hours digging deeper into the web. But the no answer so far. Why we get this error when you upload a file The uploaded file could not be moved to wp-content/uploads I tried various file persimission on folders and files in the ftp. Tried a fresh install WP. I tried this code define( ‘UPLOADS’, ‘wp-content/uploads’ ); I tried adding the path in the wp/options.php location for upload_path. I created the upload folder manually, because…

How can I create a custom meta box to add an mp4 video to a page?

I’ve cobbled together code (as I’m a php and jquery newbie) from a couple of different posts to try and get an mp4 video URL input field in the wordpress admin. I’ve been able to get a media uploader to display, choose a file and on select populate a form field with the URL in the wordpress admin however when I click update the URL disappears. I can’t for the life of me figure out what I need to do to display this URL once the page is updated. Any…

Web Design Weekly #253

Headlines ahref=“https://medium.com/@KounterB/redesigning-chrome-desktop-769aeb5ab987#.czpwkzht6”Redesigning Chrome desktop An epic post by Sebastien Gabriel that looks at what was done and how it was achieved during the process of redesigning Chrome desktop. (medium.com) Don’t ruin your Adding images to websites is easy. It’s so easy the majority of us just add a value to the src attribute and move on. Anthony Ng reminds us that we aren’t doing our images or users any favours by doing this and shares a few handy tips to get us back on track. (freecodecamp.com) Sponsor Web Design Weekly…

Custom taxonomy filter for media

I have the following code already working in the admin for my media library: function atelier_add_iCat_taxonomy() { $labels = array( ‘name’ => ‘iCats’, ‘singular_name’ => ‘iCat’, ‘search_items’ => ‘Search iCats’, ‘all_items’ => ‘All iCats’, ‘parent_item’ => ‘Parent iCat’, ‘parent_item_colon’ => ‘Parent iCat:’, ‘edit_item’ => ‘Edit iCat’, ‘update_item’ => ‘Update iCat’, ‘add_new_item’ => ‘Add New iCat’, ‘new_item_name’ => ‘New iCat Name’, ‘menu_name’ => ‘iCat’, ); $args = array( ‘labels’ => $labels, ‘hierarchical’ => true, ‘query_var’ => ‘true’, ‘rewrite’ => ‘true’, ‘show_admin_column’ => ‘true’, ); register_taxonomy( ‘iCat’, ‘attachment’, $args ); } add_action(…

oEmbed Video in Modal

I’m attempting to use jQuery to open up a video in a modal but can’t come up with a way to pass the oEmbed video url to the function which opens the modal. In my theme the user adds the video to an ACF (Advanced Custom Fields) oEmbed field on the post and then I want the video to pop up in an overlay when they click on a link. I’d like it to work something like: function revealModal( event ) { $(‘body’).prepend(‘<div class= »modal visible »><div class= »modal-content »></div><a class= »close »></a></div>’); $(‘.modal-content’).html(‘<div class= »embed-container »><iframe width= »1280″…

Can multiple authors be assigned on a single custom post?

I have custom post types that I would like to make editable by several users. I created one custom post type using the Toolset plugin. wp_update_post only allows us to set single author: $user_id = array(); $userIds = get_field(« agency_to_author »,$_POST[‘post_ID’]); // Get Multiple User assing using acf field. foreach ($userIds as $key => $value) { $user_id[] = $value[‘ID’]; } if(!empty($user_id)){ $arg = array( ‘ID’ => $_POST[‘post_ID’], ‘post_author’ => $user_id, ); wp_update_post( $arg ); } Source: https://wordpress.stackexchange.com/feeds

ajax live search for post title

i m creating a AJAX live search to filter posts title in my wordpress theme. As i write something in input it show all the post in result, Not filtering it to get custom post.. How to search live and find a post with AJAX?? Function.php <?php add_action(‘wp_ajax_my_action’ , ‘data_fetch’); add_action(‘wp_ajax_nopriv_my_action’,’data_fetch’); function data_fetch(){ $the_query = new WP_Query(array(‘post_per_page’=>5)); if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> <h2><a href= »<?php echo esc_url( post_permalink() ); ?> »><?php the_title();?></a></h2> <?php endwhile; wp_reset_postdata(); endif; die(); }?> Script: <script> function fetch(){ $.post(‘<?php echo admin_url(‘admin-ajax.php’); ?>’,{‘action’:’my_action’}, function(response){ $(‘#datafetch’).append(response);…

How to securely provide a $_POST var in WP_Query with PHP 7?

In PHP 5.5 you had the function mysql_real_escape_string() and I always did htmlspecialchars(mysql_real_escape_string($_POST[‘…])); to secure against SQL-Injection. With PHP 7 mysql_real_escape_string() is gone. An alternative is mysqli_real_escape_string() but that function needs a link to the mysqli object. When using WordPress to perform a query like this: $query_args = array( ‘s’ => $_POST[‘search’] ); $query = new WP_Query( $query_args ); I can’t provide a mysqli object. So Do I have to leave all the security stuff to WordPress? Is it enough to do: $query_args = array( ‘s’ => htmlspecialchars( $_POST[‘search’] )…

Permalinks not working after updating WordPress

Recently I have installed a new version of WordPress and immediately I tried to change permalinks to /%postname%/ and now it’s not showing the result. Everything is default according to WordPress.org and nothing has been added to the theme or admin panel. What could be causing this issue? Source: https://wordpress.stackexchange.com/feeds