How can I identify it as admin page or not?
Use is_admin() function. It will return true if it’s wp-admin page and false on frontend. more here https://developer.wordpress.org/reference/functions/is_admin/
Use is_admin() function. It will return true if it’s wp-admin page and false on frontend. more here https://developer.wordpress.org/reference/functions/is_admin/
There is indeed an unwanted ; (semicolon) in your function (try to look at line 99 in the twentytwentyone-child/functions.php file) which likely is the cause to the syntax error. So just remove that ; and the error would be gone: function my_service_template_footer_data() { echo “<script type=”application/ld+json”> { ‘@context’: ‘https://schema.org/’, ‘@type’: ‘Service’, ‘serviceType’: ‘ ” . … Read more
“Widgets” as you’re calling them on the post edit screen are actually meta boxes. You can add as many as you want to do whatever you want using the add_meta_box() function. Once you know what they’re called, it’s fairly straight-forward to do a Google search for examples. Or check out some great tutorials listed in … Read more
This seems like raw SQL that won’t make sense to PHP at all. You can run this queries, as raw queries using $wpdb->query() but it’s more proper to use its $wpdb->insert() method. See wpdb Class > INSERT rows in Codex.
The function which is used internally (since 3.1) is get_edit_term_link( $term_id, $taxonomy, $object_type=”” ). Source view here. There’s also a function called edit_term_link that will format the link output for you. The built-in functions are probably better to use, because they check for user capabilities, etc., and are better for future compatability. That said, I … Read more
I think it’s really a question of whether that code is giving the correct hook name for the given page. Here’s a simple function you can use to output the hook suffix on each admin page, it will appear inside a red error box(so it’ll be easy to spot) for admins only. add_action( ‘admin_notices’, ‘print_admin_pagehook’ … Read more
Completely skipping wp_head and wp_footer doesn’t seem like a good idea, many core components and plugins depend on these hooks. Instead, you could create a light header and footer, and load them via an extra argument to get_header() and get_footer(). get_header( ‘light’ ) will load header-light.php instead of the regular header file. Create one without … Read more
If the page needs to be added and available on the front end, you can use wp_insert_post() to create the page, the use a conditional to only display it if the user is logged in: if(is_user_logged_in()) { // display content }
If you don’t know, and can’t control, the content width, then your Plugin shouldn’t assume any given content width. Also, even though templates may be 960px in total width, the content width will almost assuredly be less than that. If you must apply explicit width to your output, you could try returning the value set … Read more
I suggest using get_posts because you are able to set “paged” parameter there. <?php // Posts Per Page option $ppp = 3; // find out on which page are we $paging = isset( $_GET[‘list’] ) && ! empty( $_GET[‘list’] ) ? $_GET[‘list’] : 1 ; // arguments for listed pages $args = array( ‘posts_per_page’ => … Read more