Using a _GET gives me a debug error (over my head)

The error is occurring as the $_GET array doesn’t have the item $_GET[‘do’] in it. Therefore it throws this notice. To check if something exisits in the array try: if( isset( $_GET[‘do’] ) ) $do_that = $_GET[‘do’]; else $do_that=””; or a cleaner method would be to use short hand notation $do_that = ( isset( $_GET[‘do’] … Read more

display URL or permalink instead of page title in dashboard

Filter ‘the_title’ on the screen with the list table of your post type. The pattern for the initial hook is: manage_edit-post_type_name_columns. Sample code: // replace ‘post’ with the post type name you want to catch. add_filter( ‘manage_edit-post_columns’, ‘wpse_67171_title_to_url’ ); /** * Replace the default title with its permalink. * * @param string $title * @param … Read more

Use image url with add_image_size

The pattern you posted… www.mydomain.com/image.jpg(‘custom-thumb’); … is a bit odd. That would be pretty tricky. You’d need a PHP handler to load the image and you’d need to tell the server (Apache, Nginx, IIS, Whatever) to parse that file ending as PHP. Something like this would be simpler: www.mydomain.com/image.php?size=custom-thumb You would still need to create … Read more

base directories / URL

You can manually create pages named category and app in admin under the Pages menu, and use a custom page template for each to list out taxonomy terms or whatever you need. EDIT – 301 redirect a request that matches the pagename rewrite to another page: function wpa_parse_query( $query ){ if( isset( $query->query_vars[‘pagename’] ) && … Read more

I’m confused about URL sanitization in meta boxes

Choice between esc_url and esc_url_raw depends on the use you have to do with the url. If you have to use the url to display inside html use esc_url, E.g.: $my_link = get_post_meta( $post->ID, ‘mod_modbox_link’, true ); echo ‘<a href=”‘ . esc_url($my_link) . ‘”>Open link</a>’ esc_url_raw should be used for any other use, where the … Read more

How to make menu items active based on hash

This can be accomplised fairly easy by checking the URL then setting the appropriate link to active. That can be accomplished by the following… var hash = window.location.hash.substr(1); // Get the text after the hash $(‘a[href=”#’ + hash + ‘”]’).addClass(‘active’); // Set the correct link to active However, there are some things to consider. Someone … Read more

Callback URL in WordPress

That’s pretty simple, just use your website home url 🙂 After that, just fire an action when the page is loaded via POST HTTP method and hook with a callback. add_action( ‘wp_loaded’, function() { if ( $_SERVER[‘REQUEST_METHOD’] === ‘POST’ ) { // fire the custom action do_action(‘onchangeapi’, new PostListener($_POST)); } } ); And now the … Read more

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