Tag Info

New answers tagged

3

Ok my bad found the answer on the codex page but at the very bottom so I'm adding this here as well so if anyone like my didn't catch it on WordPress's codex, they can find it here :) Just use get_admin_page_title(); See the example 1 below: function register_my_custom_submenu_page() { add_submenu_page( 'tools.php', 'My Custom ...


0

From what I understand from your question, your best course of action is to assign the node to a Wordpress callback function using built-in AJAX. If you don't know what I'm talking about, you should familiarize yourself with using AJAX in Wordpress in the Codex. However, here is a basic overview of steps: Add a function in a JS file that is attaches a ...


0

There is a filter called post_gallery which allows you to create your own html for your gallery. You could copy and edit the code from the gallery_shortcode function, (which creates the gallery code? and use that in the filter, with titles included/


1

The quick & dirty way, to set the title as caption, would be to use SQL (untested): UPDATE wp_posts SET post_excerpt = post_title WHERE post_excerpt = '' AND post_type = 'attachment' AND post_status = 'inherit' AND post_mime_type = 'image/jpeg' AND ID = 123 Here we target the jpeg image with ID ...


0

It means that you want to load that image on post right... place the below code where you want images <?php $post_id = 75; $thumbnail_id = 112; if(!empty(get_the_title($thumbnail_id))){ echo '<img src="img.jpg" title="'.get_the_title($thumbnail_id).'" />'; } else{ echo '<img src="img.jpg" title="'.get_the_title($post_id).'" />'; } ...


2

You can try the following test plugin, that uses the domDocument class, to see how it works on your HTML. It assumes PHP 5.4+ with LibXML 2.7.8+. <?php /** * Plugin Name: Add Missing Image Title Attributes * Description: For posts in the main loop (Assumes PHP 5.4+ with LibXML 2.7.8+) * Plugin URI: http://wordpress.stackexchange.com/a/188560/26350 ...


0

Does the image title attribute actually have to be in the database? If it's only the matter of displaying text, for example in the photo gallery, would't using a jQuery function serve your purpose? Something like: $(document).ready(function() { $('img').each(function() { if ($(this).attr('title') === undefined) { var title = $('h1').text(); ...


1

If we can assume that this is done properly for images that are in templates, and you're only concerned about page/post body content, you could use a filter when saving any post or page ( https://codex.wordpress.org/Plugin_API/Action_Reference/save_post ) to scan the content Since this action is triggered right after the post has been saved, you can ...


0

Well I felt I better update this old question, the SEO plugin by Yoast now allows assigning of all SEO abilities to custom post type archives. So that's the best solution.


0

Another easy way of doing it is installing Yoast's SEO plugin. There you can specify an "SEO title" for each post which is the Title Tag, and then you can name the post a different thing, which would be the H1 tag in most themes.


3

First things first, lets clean up your code: <?php $wptitle = the_title(); $wptitle = str_replace('&', 'and', $wptitle);?><?php echo $wptitle; ?> Lets remove the PHP tag spam and put things in nice clean lines: <?php $wptitle = the_title(); $wptitle = str_replace('&', 'and', $wptitle); echo $wptitle; ?> Now if we look at the ...



Top 50 recent answers are included