How to use PHP code with wordpress page

The best way to create dynamic data outputs really depends on the what, why, and how. For example, if you’re creating a theme that creates its own custom post type, say, to store information about the head honchos that run the business behind the site, then just create a “single-$CPTNAME.php” template that has the code … Read more

Hide cart when empty [closed]

Just add another AND (&&) clause to the end of it. <?php if ( is_woocommerce_activated() && isset( $woo_options[‘woocommerce_header_cart_link’] ) && ‘true’ == $woo_options[‘woocommerce_header_cart_link’] && sizeof( $woocommerce->cart->cart_contents ) !== 0) {…} Probably best to take a look at some of the PHP tutorials or documentation around as you will be coming up against this type of … Read more

No Authors for custom post type

You need to include the post type in the pre_get_post filter: (Not sure about global $user_ID;, just reproduce that part of your code) function content_for_current_author($query) { if($query->is_admin) { global $user_ID; $query->set(‘author’, $user_ID); $query->set( ‘post_type’, array(‘acf’, ‘another-custom-pot’, ‘page’, ‘post’) ); } return $query; } add_filter(‘pre_get_posts’, ‘content_for_current_author’); Details in WP Query documentation for Type Parameter Also, your … Read more

How to map my php files as the files for pages

Use page templates, an overview can be found here: http://codex.wordpress.org/Page_Templates Edit for those afraid of dying links: A page template file should be placed in the theme folder, with any name you like. In its header, it should have <?php /* * Template Name: My Custom Page * Description: A Page Template with a darker … Read more