Pulling posts into static site (wordpress as subdirectory)

There are several ways to do it: SQL query to the wp database Using a Restfull API plugin: https://wordpress.org/plugins/json-api/ you will get the json of the posts. Using the RSS Feed (check this tutorial http://code.tutsplus.com/articles/how-to-read-an-rss-feed-with-php-screencast–net-1272) To be very light you can cache the results will all options. You can grab the results and cache that … Read more

Where should I put this custom data?

Supposing that each food item is treated as a post (perhaps even a custom post type), and the parameters (name/calories/etc.) are attributes of this post, you would do well to treat them as post meta fields. Various means exist to grant end-users the ability to maintain custom fields; my preferred option is Developer’s Custom Fields, … Read more

WordPress custom search – pagination

Working code: $display_count = 2; global $wp_query, $paged; $pages = $wp_query->max_num_pages; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $offset = $page – 1; $showposts = 10; $args = array( ‘showposts’ => 20, ‘post_type’ => ‘any’, ‘post__in’ => $WPIDs, ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘cf_dimensjon’, ‘order’ => ‘ASC’, ‘number’ => $display_count, ‘paged’ => $paged ); $wp_query … Read more

How to loop through 1 CPT with 2 Taxonomies

You probably want to use wp_get_post_terms(). If a product is always associated to only one category – which has no child if hierarchical – (what I understand from your example), adding below snippet within your while loop should do it (not tested). <? $cat = wp_get_post_terms( get_the_ID(), ‘department’ ); echo ‘<span>(‘ . $cat->name . ‘)</span>’; … Read more

ACF Shortcode bringing in my shortcode is adding unnecessary line breaks

It was solved by a coworker. function removebreaks($content) { $content = str_replace(‘<br>’, ”, $content); $content = str_replace(‘<br/>’, ”, $content); $content = str_replace(‘<br />’, ”, $content); $content = str_replace(‘<BR>’, ”, $content); $content = str_replace(‘<BR/>’, ”, $content); $content = str_replace(‘<BR />’, ”, $content); return $content; } add_filter(‘acf_the_content’, ‘removebreaks’);

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