How to include stylesheet in custom admin using parent_slug

Don’t confuse menu structure with page/URL structure. Each one of your pages may have a different hook. Do this: function my_enqueue($hook) { echo $hook; } add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ ); Load your pages and write down the hook names. There may be other ways to do this too, like the admin-print-scripts-$hook_suffix hooks. Look in wp-admin/admin-header.php to … Read more

How to get or know the slug of home.php

Use is_home() for the home page (the list of newest blog posts), and is_front_page() for the front page (can be a static page too). if( is_home() ) { wp_nav_menu( array( ‘menu’ => ‘Main Nav Menu’, ‘container’ => ” ) ); }

How to controll the Posts post type and general wondering about WP data structure

You can use the globals $menu, $submenu and $wp_post_types for renaming. Code: function wpse124233_alter_builtin_post_menu_label() { global $menu; global $submenu; $menu[5][0] = __( ‘YourName’ ); $submenu[‘edit.php’][5][0] = __( ‘YourName’ ); $submenu[‘edit.php’][10][0] = __( ‘Add YourName’ ); $submenu[‘edit.php’][16][0] = __( ‘YourName Tags’ ); } add_action( ‘admin_menu’, ‘wpse124233_alter_builtin_post_menu_label’ ); function wpse124233_alter_builtin_post_labels() { global $wp_post_types; $labels = &$wp_post_types[‘post’]->labels; $labels->name … Read more

sort by name (slug) custom post type

The “sort” query param is usually “orderby” not “sortby”, to match the SQL ORDER BY clause. Perhaps try: $the_query = ‘posts_per_page=-1&orderby=name&order=ASC&post_type=mycustom&custom_cat=mycat’; It’s also possible that the value you are passing is incorrect, but without knowing the details of your custom post type there’s not much else I can suggest.

post type slug vs page slug

You can created a post template to display the CPT post details (i.e. videos/my-video) and you can create an archive template to display a list of posts (i.e. videos/). To create a post template in a plugin, add the following to the plugin: function include_templates( $template_path ) { if ( get_post_type() == ‘videos’ ) { … Read more

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