Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>At add_action documentation it says that</p> <pre><code>add_action( $hook, $function_to_add, $priority, $accepted_args ); </code></pre> <blockquote> <p>$hook : The name of the action to which $function_to_add is hooked. (See Plugin API/Action Reference for a list of action hooks). Can also be the name of an action inside a theme or plugin file, or the special tag "all", in which case the function will be called for all hooks)</p> </blockquote> <p><a href="http://codex.wordpress.org/Function_Reference/add_action" rel="nofollow">http://codex.wordpress.org/Function_Reference/add_action</a></p> <p>So or you either declare a action hook that is provided from wordpress core (See the list here : <a href="http://codex.wordpress.org/Plugin_API/Action_Reference" rel="nofollow">http://codex.wordpress.org/Plugin_API/Action_Reference</a>) or you can provide your action but this action, in your case the_excerpt_slider();, has to be declare somewhere in your function.php file. So that's whay you get this error. the_excerpt(); is working fine because is a core function of wordpress.</p> <p><strong>UPDATE</strong></p> <pre><code>add_action('the_excerpt','limit_the_content'); function limit_the_content($content){ global $post; if('slider' == get_post_type($post-&gt;ID)){ $settings = get_option('mytheme_options'); $word_limit_slider = $settings['numberofwordsexcerptslider']; $words_slider = explode(' ', $content_slider); return implode(' ', array_slice($words_slider, 0, $word_limit_slider)); }else{ $settings = get_option('mytheme_options'); $word_limit = $settings['numberofwordsexcerpt']; $words = explode(' ', $content); return implode(' ', array_slice($words, 0, $word_limit)); } } </code></pre> <p>In this line of code : </p> <pre><code>'slider' == get_post_type($post-&gt;ID) </code></pre> <p>the 'slider' is the name of your custom post. You have to change it to your defined name. You can find it if you go to the admin panel and go where all your sliders are shown up. In the url you should see something like :</p> <pre><code>http://yoururl/wp-admin/edit.php?post_type=slider </code></pre> <p>so the name of your custom post is after the <code>?post_type=</code></p> <p>Also inside your file you should change the <code>&lt;?php the_excerpt_slider(); ?&gt;</code> to <code>&lt;?php the_excerpt(); ?&gt;</code> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload