Add code just after Post content

There are some global variables available (or not) to detect the current page number: if ( empty ( $GLOBALS[‘multipage’] ) or $GLOBALS[‘numpages’] === $GLOBALS[‘page’] ) echo ‘<a id=”lastPageLink” href=”#comment”>comment</a>’; The best way to understand what they do is a look at the internals of wp_link_pages(). (bool) $GLOBALS[‘multipage’] is TRUE if there is more than one … Read more

New to CMS – WP functionality. overkill or just right?

For the most part, I believe WordPress will do just fine. You will have to brush up on your knowledge of PHP to get the hang of creating your own custom templates, but there are plenty of sites (This One Included) that will help guide you. There are also a plethora of free & premium … Read more

Add scripts on custom post add/edit pages Not Working

There are a few things you’ll want to do to make you include work and in generally better. Here is the complete code: function my_theme_enqueue_admin_scripts() { $screen = get_current_screen(); // This is how we will check what page we are on if ( in_array( $screen->id, array( ‘post’, ‘page’) ) && $screen->action == ‘add’ ) { … Read more

Add multiple=”multiple” attribute to categories dropdown

Take a look at the source of wp_dropdown_categories(). It uses walk_category_dropdown_tree() to render the output. Right after that you have a filter named wp_dropdown_cats that allows altering the final MarkUp: $output = apply_filters( ‘wp_dropdown_cats’, $output ); You could now use a Regex and preg_replace or parse it using DOMDocument, etc. Keep in mind that you … Read more

How do I put a wordpress blog into my html site?

Either install wordpress in a subdomain (blog.yoursite.com or sub folder (yoursite.com/blog) Design the WordPress site exactly like your current website to get a consistent design. Or make your entire website in WordPress. WordPress can be used for many other things than blogging.

How to only show page id as body class?

Honestly, it’s source code. The only people who see it are you and other developers. Anybody casually visiting your website will never know or understand this stuff so really there’s no harm keeping it there. Buttttt… if you want to get rid of it you could filter body_class: function custom_body_class( $classes ) { global $post; … Read more

Placing raw HTML inside a WordPress shortcode

For the sake of having @Milo’s comment as an answer. Your code works as it should, it is just not possible to “write” HTML in the visual editor also in shortcodes. Shorcodes are not treated differently then any other text. If you want formatted HTML in your shortcode you just need to use the normal … Read more

Adding JSON Structured Data to WordPress

If you’re creating the theme yourself, you can always use Schema Microata markup directly in the theme itself. As we can see in the below example, adding extra attributes to your HTML can make it Schema compliant. In this instance, we are using itemscope, itemtype and itemprop: Taken from http://schema.org/docs/gs.html#microdata_how <div itemscope itemtype =”http://schema.org/Movie”> <h1 … Read more

: Failed to load resource

I see a few errors in your code: Your first line: <html lang=”<?php language_attributes(); ?>” dir=”ltr”> should actually be: <html <?php language_attributes();?> dir=”ltr”> (notice that you dont need to add lang=. The function does that by itself. That will likely fix the problem) You didn’t add the ; to 2 of your lines in the … Read more

Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function

The default walker used by wp_list_categories() (Walker_Category) has a hook (a filter hook) named category_list_link_attributes which you can use to add custom title and class (as well as other attributes like data-xxx) to the anchor/a tag (<a>) in the HTML list generated via wp_list_categories(). So for example, you can do something like: add_filter( ‘category_list_link_attributes’, ‘my_category_list_link_attributes’, … Read more