use jQuery.load() to include a php file in a div, wp_query() is part of php file

Using AJAX in WordPress is fundamentally pretty simple. You need a function that handles the AJAX request, and a couple of add_action calls to map that function to the action you pass to admin-ajax.php, in this case, some_action: function wpd_ajax_function() { get_template_part( ‘my-content’ ); wp_die(); } add_action( ‘wp_ajax_some_action’, ‘wpd_ajax_function’ ); add_action( ‘wp_ajax_nopriv_some_action’, ‘wpd_ajax_function’ ); This … Read more

wp-cli for Creating page-template

wp-cli is not a development tool, it is a server admin tool, as such all the scaffold stuff there is…. for lack of better word, unneeded bloat. It is unlikely to reflect best practice, especially if your copy is old. In the specific case of page templates, there is really nothing worth “scaffolding” the easiest … Read more

Display custom field on 404 page outside loop

You should not hide functionality in a template file. Templates are dumb, you don’t run unit tests on them normally. I’d recommend to move the logic to a separate function in your functions.php: function header_class( $default=”white” ) { $post = get_post(); // 404 pages, empty archives (user, taxonomy, date) if ( empty( $post ) ) … Read more

Insertng HTML and jQuery into a page that uses the Defaut template

There are 2 options: Copy the WooCommerce file into your theme, then make whatever changes you like. Since you’re using a default theme, you’d need to create a child theme. In this case, you’d copy /wp-content/plugins/woocommerce/templates/checkout/for-m-checkout.php (the whole file) into /wp-content/themes/yourchildthemename/woocommerce/checkout/form-checkout.php and do whatever you like – the child theme will also need a style.css … Read more

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