How to display alt tags in img src?

You are using the Advanced custom fields plugin. The documentation for images: http://www.advancedcustomfields.com/resources/image/ To display the alt-tag for example, you can use this snippet: $image = get_field(‘image’); if( !empty( $image ) ) { $alt = $image[‘alt’]; … echo ‘<img src=”https://wordpress.stackexchange.com/questions/216629/…” alt=” . $alt .”>’ }

How to append to title via functions.php for auto-posting plugin [duplicate]

Whoa, this Plugin was a nightmare to look through. But I got a solution for you. In the description for your links, you can use the placeholder %FULLTITLE% instead of %TITLE%. %FULLTITLE% applies the filters for the title. From nxs_functions_adv.php Lines 19 & 20: if (preg_match(‘/%TITLE%/’, $msg)) { $title = nxs_doQTrans($post->post_title, $lng); $msg = str_ireplace(“%TITLE%”, … Read more

Is it possible to use multiple spaces in title?

As you can see in the Codex, the filter actually has 2 arguments, which needs to be stated: add_filter( ‘the_title’, function ( $title, $id = null ) { return preg_replace(‘#(\s{3})#’, ‘&hellip;’, $title); }, 10, 2 ); You could as well just use a placeholder that you replace on the fly – might be easier. In case … Read more

How to Orderby Comments by post title?

The WP_Comment_Query class supports ordering by: ‘comment_agent’, ‘comment_approved’, ‘comment_author’, ‘comment_author_email’, ‘comment_author_IP’, ‘comment_author_url’, ‘comment_content’, ‘comment_date’, ‘comment_date_gmt’, ‘comment_ID’, ‘comment_karma’, ‘comment_parent’, ‘comment_post_ID’, ‘comment_type’, ‘user_id’, ‘comment__in’, ‘meta_value’, ‘meta_value_num’, There’s a way to adjust it via filters so we can support ordering by the post title: $args = [ ‘status’ => ‘approve’, ‘post_status’ => ‘publish’, ‘post_type’ => ‘post’, ‘orderby’ => … Read more

Add acf field in title (admin table)

Use this to filter the title: add_action( ‘admin_head-edit.php’, ‘wpse264139_edit_post_change_title_in_list’ ); function wpse264139_edit_post_change_title_in_list() { add_filter( ‘the_title’, ‘wpse264139_construct_new_title’, 100, 2 ); }` `function wpse264139_construct_new_title( $title, $id ) { if(get_post_type($id) == ‘post_type’) { $field = get_field(‘place’, $id); return $field . ” ” . $title; } else { return $title; } } NOTE: most of the code came from: … Read more

Remove Title of youtube video

Update: Try this one.. it works for youtube url in your post which is converted to iframe by wordpress. function remove_youtube_controls($code){ if(strpos($code, ‘youtu.be’) !== false || strpos($code, ‘youtube.com’) !== false){ $return = preg_replace(“@src=([‘\”])?([^’\”>]*)@”, “src=$1$2&showinfo=0&rel=0”, $code); return $return; } return $code; } add_filter(’embed_handler_html’, ‘remove_youtube_controls’); add_filter(’embed_oembed_html’, ‘remove_youtube_controls’);

How get get list of pages in ajax search

There is no get_pages() method in the WP_Query class (for WordPress version 4.9.4). So in the data_fetch() function, replace the following: if( $the_query->get_pages() ) : while( $the_query->get_pages() ): $the_query->get_pages(); ?> ..with this: if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> And in the fetch() JS function, set the type to POST, like so: function … Read more