How to handle parent and child pages?

Problem 2: displaying the 3 panels. Do I set these up as individual children elements? If so, how can I style each one differently as it loops through? There are only 3 items. Don’t loop through them. Use get_posts() to place them in an array and then step through each array item: $panels = get_posts( … Read more

Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)

In general, this function lets you localize your JS strings, but you can also use it to set global JS variables: function set_my_js_var() { // logic here for returning the right JS var $myVar = “Hello World”; return $myVar; } function load_fe_scripts() { wp_enqueue_script( ‘global-js-var’, get_template_directory_uri() . ‘/js/my_file.js’ ); $localize_array = array( ‘my_js_var’ => set_my_js_var() … Read more

WordPress White Screen Error

What causes this? It may be a line ending problem. In *nix, the line ending is a single new line character. In windows it is a carriage return character followed by a new line character. Unicode encoded files can also affect line endings. Check your text editor documentation. There should be a way to convert … Read more

How to create categories out of a list of words?

Assuming you have a nice list of your Words, you could easily create an array with them, doing a little data manipulation. Afterwards you can loop throug your $array and insert the Term accordingly: $yourcities = file($filename, FILE_IGNORE_NEW_LINES); // all your valuesfrom the .txt file foreach( $yourcities as $thiscity ) { wp_insert_term( $thiscity, // the … Read more

Error in php code

This is no WordPress error (as you can see due to the page being completely loaded, see the WordPress footer, for instance) — it is a user error. In the add_submenu_page call, you specified the function wptuts_landing_settings_page, while your actual function is called director_settings_page.

Excerpt all post content Content Same Size without word cutting off

I use wp_trim_words to create multiple excerpts. I always abuse it when I need more than one excerpt length. Here is how function wpse_custom_excerpts($limit) { return wp_trim_words(get_the_excerpt(), $limit, ‘<a href=”‘. esc_url( get_permalink() ) . ‘”>’ . ‘&nbsp;&hellip;’ . __( ‘Read more &nbsp;&raquo;’, ‘wpse’ ) . ‘</a>’); } What this function do is taking get_the_excerpt trimming … Read more

echo vs output variable [closed]

I believe this topic was addressed quite thoroughly here. I might add that within the WordPress community it is common syntax practice to default to echoing tags with an option or alternative/interior function to return the result instead. This I believe is driven by the level of code experience the average user within WordPress has … Read more