Title: Some thoughts on mpp_toc function
Last modified: June 14, 2020

---

# Some thoughts on mpp_toc function

 *  Resolved [TiKu](https://wordpress.org/support/users/tiku/)
 * (@tiku)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/some-thoughts-on-mpp_toc-function/)
 * Currently I’m using a highly customized version of your great plugin. Since you’ve
   added some good filters, I could already reduce my code additions to the plugin’s
   code a lot. Currently I’m trying to get rid of my code changes in the `mpp_toc`
   function.
    I think I have found a problem in your code: `if ( $i != $page || !
   $more && 1 == $page ) {` In my opinion there are missing paranthesis. Otherwise
   you have the `||` operator at the same level as the `&&` operator which rarely
   is a good idea.
 * But my main reason for opening this topic are the filters `mpp_toc_pages_row`
   and `mpp_toc`. In the beginning of the `mpp_toc` function you retrieve the params
   and apply the `mpp_toc_args` filter to it, allowing customizations. But to the`
   mpp_toc` filter you pass the original params instead of the customized ones. 
   Of course I could customize the params once again, but wouldn’t it be better 
   to pass `$r` instead of `$args`?
    Also `$r` is not passed to the `mpp_toc_pages_row`
   filter. Therefore it is not possible to generate different rows in the filter
   depending on `$r`. Passing `$r` to the `mpp_toc_pages_row` filter would be really
   nice.
 * Best regards
    TiKu

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Sergio De Falco](https://wordpress.org/support/users/sgr33n/)
 * (@sgr33n)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/some-thoughts-on-mpp_toc-function/#post-12988682)
 * Hi,
    Thanks for your feedback! What’s the error generated by the first point?
   Then I pass the raw elements to the filter because the user that is using this
   filter probably needs to rework the output. If the user wants the multipage original
   output doesn’t need to use this filter.
 *  Thread Starter [TiKu](https://wordpress.org/support/users/tiku/)
 * (@tiku)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/some-thoughts-on-mpp_toc-function/#post-12989652)
 * > What’s the error generated by the first point?
 * No syntactical error, but which of the logical operators is executed first? The“
   ||” or the “&&”? And if you can answer this, can you be sure that it will stay
   like this (because it is properly defined in the PHP language definition)?
 * Regarding the filters, I’m also trying to rework the output, but in my case I
   have no use for the raw elements. I would need the processed ones, held by `$
   r`. So I’ll end up duplicating code from the `mpp_toc` function.
 *  Plugin Author [Sergio De Falco](https://wordpress.org/support/users/sgr33n/)
 * (@sgr33n)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/some-thoughts-on-mpp_toc-function/#post-12989692)
 * This is the best approach in my opinion.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Some thoughts on mpp_toc function’ is closed to new replies.

 * ![](https://ps.w.org/sgr-nextpage-titles/assets/icon-256x256.png?rev=2291460)
 * [Multipage](https://wordpress.org/plugins/sgr-nextpage-titles/)
 * [Support Threads](https://wordpress.org/support/plugin/sgr-nextpage-titles/)
 * [Active Topics](https://wordpress.org/support/plugin/sgr-nextpage-titles/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sgr-nextpage-titles/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sgr-nextpage-titles/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Sergio De Falco](https://wordpress.org/support/users/sgr33n/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/some-thoughts-on-mpp_toc-function/#post-12989692)
 * Status: resolved