get current page number with wp_link_pages()

wp_link_pages depends on four globals— $page, $numpages, $multipage, and $more. I cannot test this right now, but if I remember correctly $page is the current page and $numpages is the total number of pages. All you should need is: global $page; echo $page;

Block wordpress style for my plugin admin page

The admin stylesheets combines rules for everything: tool bar, left menu, footer and some common elements like tables and forms. You cannot disable just a part of it. If you want to apply your own rules, use a higher specificity in your CSS rules. Normally, all plugin pages use the same wrapper element: <div class=”wrap”> … Read more

How do I define and register a shortcode function in a namespaced functions.php file?

Thanks to Stanislav Khromov (also active on WPSE!), I learned any Callable referenced in add_shortcode() must be fully qualified, even if it is defined in the same file you’re referencing it. <?php /** * theme’s functions.php */ namespace MyNamespace; //[foobar] function foobar_func( $atts ){ return “foo and bar”; } add_shortcode( ‘foobar’, ‘\MyNamespace\foobar_func’ ); You may … Read more

What are these undocumented arguments for register_taxonomy?

I suspect the Taxonomies Codex entry is simply out of date. Per source, there are no ‘sort’ or ‘orderby’ args for register_taxonomy(). Given the purpose of the register_taxonomy() function, it doesn’t even really make sense for this function to include sort/orderby parameters. Such parameters would be relevant to listing taxonomy terms, not to registering the … Read more

Do I need to include a textdomain if my theme doesn’t support translation?

If your code, be it a theme or a plugin, does not support translation, then don’t use the translation functions. And if you don’t use these functions, you cannot use a text domain. 🙂 There is a very common error that looks like this: echo __( ‘Portfolio’ ); Portfolio is not part of WordPress’ core … Read more

post_class not working with css

First of all, <?php post_class(); ?> function prints a string that contains html ‘class’ attribute. So, whenever you are using this function inside class attribute, then you are actually printing another class attribute inside class attribute. That’s why your class is not working. Secondly, since <?php the_content(); ?> function may contains <p> tag, that’s why … Read more

get_month_link uses what wordpress template?

get_month_link() doesn’t use any template. It just creates a link to date based archives. The actual template used is decided by a rather complicated template hierarchy system managed by Core. Essentially there is a cascading sequence of files that will be used if those files are provided by the theme: date.php archive.php index.php

REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead

Is the image in a child theme? If so, use get_stylesheet_directory_uri() instead as it will grab the child theme URL. get_template_directory_uri() grabs the parent theme. Depending on your PHP version adding a semicolon also might make a difference, and typically image src uses double quotes rather than single. <img src=”https://wordpress.stackexchange.com/questions/286570/<?php echo get_stylesheet_directory_uri(); ?>/img/no_results_found.png” />

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)