Articles of functions

Excerpt for pages not showing

I am creating a simple wordpress theme and need excerpts for pages. I have tried the code from many topics some resolved on ‘wordpress SO’ but nothing works. Because I created the theme from scratch I added a blank functions.php file and put the following code in it. add_action( ‘init’, ‘my_add_excerpts_to_pages’ ); function my_add_excerpts_to_pages() { […]

Dequeue Script Using Functions.php

Hello I am trying to dequeue the script “jquery.favorite.js” found in my enqueue.php: // WP_ENQUEUE_SCRIPTS static function wp_enqueue_scripts_callback() { global $javo_tso; $javo_register_scripts = Array( ‘oms.min.js’ => ‘oms-same-position-script’ , ‘common.js’ => ‘javo-common-script’ , ‘chosen.jquery.min.js’ => ‘jQuery-chosen-autocomplete’ , ‘jquery.javo.msg.js’ => ‘javoThemes-Message-Plugin’ , ‘jquery.parallax.min.js’ => ‘jQuery-Parallax’ , ‘jquery.favorite.js’ => ‘jQuery-javo-Favorites’ , ‘jquery_javo_search.js’ => ‘jQuery-javo-search’ , ‘jquery.flexslider-min.js’ => ‘jQuery-flex-Slider’ […]

Creating WordPress Shortcode with Variable

please forgive me I’m relatively new to PHP… I would like to create a shortcode called [city-name] and have tried placing the following code in my functions.php file: function get_city_name() { return $current_cityinfo[‘cityname’]; } add_shortcode( ‘city-name’, ‘get_city_name’ ); Then entered the [city-name] shortcode into a page to test and there is no luck… Is there […]

How to hightlight all ancestor menu items of a child page NOT displayed in menu

Here’s the situation: In my main navigation menu I have something that looks like this: Work with Me Latest Projects Where the Latest Projects page is a child page and sub menu item of the Work With Me page and both are displayed in the main navigation. However, I have multiple Project pages that are […]

get_template_directory() – references parent theme directory

I’ve got this line in the functions.php of my Child theme: require ( get_template_directory() . ‘/somecode.php’ ); However it’s giving me the following error: Fatal error: require(): Failed opening required <path/to/parent/theme/somecode.php> where path/to/parent/theme is actually the path of the Parent theme rather than the Child theme. Any idea why?

How do I display a date correctly that is stored in the database as a backwards 8 digit number from Advanced Custom Fields?

I am modifying someone’s WordPress theme and they have a section for upcoming tour dates. The page for inputting was made with Advanced Custom fields plugin and uses a date picker widget that stores the date as an 8 digit number backwards in the database such as 20140508 and I would like it to display […]

Function/Class to list categories with checkboxes

I want a list like in the pictue; witch is here – Posts->New->Select Categories At the moment i have this echo ‘<select name=”pn-cats[]” size=”8″ style=”width: 100%” multiple>’; $args = array( ‘type’ => ‘post’, ‘child_of’ => 0, ‘parent’ => ”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 0, ‘hierarchical’ => 1, ‘exclude’ => ”, ‘include’ […]

Nav-Menu not showing up

I would love for somebody to please help me because somewhere I am really miss understanding what WordPress is telling me. Alright so within my header.php I have the following code. <div class=”navigation navigation-top” id=”menu-nav”> <?php wp_nav_menu( array( ‘theme_location’ => ‘main-menu’ ) ); ?> <li><a href=””>Home</a> <ul> <li><a href=””></a></li> </ul> </li> <li class=”menu-search”><form method=”get” class=”form-search” […]

How to add author's posts link (HTML + PHP) inside a function to output it

I have this function on a theme which is a bit of code for a slider: function get_article_slide( $title, $excerpt, $link_article, $url_image, $title_length, $alt_image = ‘Alternative text’ ) { // Parameters if ( strlen( $title ) > $title_length ) $title = mb_substr( $title, 0, $title_length ) . “…”; $title = apply_filters( ‘prlx_slide_title’, $title, get_the_title() ); […]

How do I register a new settings page?

I need to be able to create a new settings page, one that will act as a list of information for the user. However, I am unable to find how to do this, can someone point me in the right direction for this? Either to some information or to a question here with the answer.