How to obtain the current website URL in my theme?
bloginfo(‘url’) should get you the URL for the installation. EDIT: I guess you could also use get_permalink()
bloginfo(‘url’) should get you the URL for the installation. EDIT: I guess you could also use get_permalink()
To start off, a theme does not require a functions.php file to operate. For example, a one page site can simply just have an index.php and a style.css file. Your functions.php file holds functions, filters and action hooks to add theme specific functionality to your site. This extends core functions, add complete new functionality or … Read more
Yes, you can but you will get errors about the header already being sent unless you hook into init or admin_init (or elsewhere prior to the headers being sent). I haven’t tested it, but you may be able to hook your session function into the send_headers action1 which seems like the most appropriate place since … Read more
I think you’re over thinking things. I’d simply create a new Custom Post in the plugin. That will come with it’s own backend automatically. You can then create the individual pages based on the Template Hierarchy for both the listings and individual pages. For any additional fields you need, you can either set the meta … Read more
It’s the text domain, used for translation. When you run something like this: <?php _e( ‘Hello World’, ‘html5blank’ ) ?> …WordPress will attempt to find the translated string in the loaded MO file for HTML5 Blank: load_theme_textdomain( ‘html5blank’, ‘path/to/language.mo’ );
Figured it out! $state_tax_args = array( ‘post_type’ => ‘products’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product-line’, ‘field’ => ‘slug’, ‘terms’ => $pl_slug // provided at page load ), ), ); $state_tax_query = new WP_Query( $state_tax_args ); // counter to build array $i=0; if ( $state_tax_query->have_posts()) { $state_term_list=”<select class=”form-control” id=”inputStateSelect” … Read more
Your problem is your custom query. Do not use variables that is used by default by WordPress. $posts and $post is WordPress reserved global variables. Change $post to a unique variable, something like $posts_query. When using get_posts and you need to setup postdata to make use of template tags, you have no choiche but to … Read more
The most minimal theme possible has two files: style.css and index.php. style.css /* Theme Name: Bare-bones theme*/ index.php <?php if( have_posts() ) { while( have_posts() ) { the_post(); the_content(); } } I’m not sure you could make it more “vanilla” than that. Keep in mind that any HTML markup within the post’s content will still … Read more
wp_localize_script results in your data being printed to the page before your script tag via PHP, whether it be in wp_head or wp_footer, depending on where you’ve set your script to be output. Calling wp_localize_script from an AJAX handler won’t do anything, you’re returning data via JavaScript. What you can do is put any data … Read more
In case you use native custom fields, you should look for them in wp_postmeta table (your table prefix can be different than ‘wp’).