How to use suffusion_admin_modify_option_list

General questions pertaining to how certain issues can be resolved
Forum rules
1. No offensive language and no mocking
2. Please do a thorough search before you post something. Trust us, there is a high probability that the question you are asking has been asked previously.
3. No soliciting. You cannot post here soliciting bids for people offer you quotes, or even offer money to people for some work. You will be moderated if you do so. If you are looking for help, please post your request on http://jobs.wordpress.net or http://codepoet.com
4. Please be reasonable. You are getting software and support. For free. Complicated requests from a general purpose theme are not welcome and some volunteers might lose patience with you.
5. Please do your due diligence. If you posted a query and we answered with a link, take the trouble to go through the link contents.
6. Please post with complete information. Requests for help MUST be accompanied with your URL, particularly if you are asking something like "Why am I seeing a blank space?"

Re: How to use suffusion_admin_modify_option_list

Postby sayontan » 23 Jul 2012, 06:23

Which part of this are you looking for some assistance with?

Basically you first set up the filter:
Code: Select all
add_filter('suffusion_admin_modify_option_list', 'child_admin_modify_option_list', 10, 3);


Then you set up the function:
Code: Select all
function child_admin_modify_option_list($original, $option_name, $sub_name = false) {
    if ($option_name != 'suf_post_meta_position' && $option_name != 'suf_cpt_layouts') {
        return $original;
    }
    if (($option_name == 'suf_post_meta_position') || ($option_name == 'suf_cpt_layouts' && $sub_name === 'byline')) {
        $original[] = ...;
    }
    return $original;
}
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: How to use suffusion_admin_modify_option_list

Postby mcfilmmakers » 23 Jul 2012, 15:57

Basically, If I have a byline file called byline-child.php, how would I implement it into the theme?
mcfilmmakers
 
Posts: 60
Joined: 28 May 2012, 12:25

Re: How to use suffusion_admin_modify_option_list

Postby sayontan » 23 Jul 2012, 16:18

mcfilmmakers wrote:Basically, If I have a byline file called byline-child.php, how would I implement it into the theme?

What kind of a byline is this (a line? a pullout?)? Where are you looking to use it? I don't believe this requires any change of the options - if you want to use a separate byline style, then modifying the option list is overkill - you could potentially remove the action hooks for suffusion_after_begin_post / suffusion_before_end_post / suffusion_after_content, and replace them with your calls.
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: How to use suffusion_admin_modify_option_list

Postby mcfilmmakers » 23 Jul 2012, 17:14

It is a pullout that includes meta data from the post with the post title removed.

(Can we have the option in the admin menu to remove the post title from the byline?)

I'm afraid I don't understand what options this function is supposed to enable...
mcfilmmakers
 
Posts: 60
Joined: 28 May 2012, 12:25

Re: How to use suffusion_admin_modify_option_list

Postby sayontan » 23 Jul 2012, 19:15

mcfilmmakers wrote:(Can we have the option in the admin menu to remove the post title from the byline?)

The Post title is not a part of the byline - it is a "headline". Hence there won't be any option to remove it. You can use CSS to hide the title, though.

mcfilmmakers wrote:It is a pullout that includes meta data from the post with the post title removed.

As I mentioned, you can use the existing hooks for this. In your child theme's setup function you will need:
Code: Select all
   remove_action('suffusion_after_content', 'suffusion_meta_pullout');
   add_action('suffusion_after_content', 'child_meta_pullout');


You then need to define the child_meta_pullout function:
Code: Select all
function child_meta_pullout() {
   global $post;
   if ($post->post_type != 'vehicle') {
      suffusion_meta_pullout();
   }
   else {
      get_template_part('custom/byline-child');
   }
}


The "Suffu-scion" starter should provide you with placeholders for plugging in the above code.

mcfilmmakers wrote:I'm afraid I don't understand what options this function is supposed to enable...

Which function - suffusion_admin_modify_option_list? I thought you were the person who asked for the capability to add more options to the drop-down :? ! That is what the function does. The code I have provided to you in my previous response shows you how to add values to specific options.
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: How to use suffusion_admin_modify_option_list

Postby mcfilmmakers » 24 Jul 2012, 05:11

Thank you for your response.

What you've provided will allow me to do what I want. While the post title is a headline, the code for it appears in the byline files hence why I was wondering why there was no option to simply exclude it without deleting it entirely. Then again, maybe I'm the only one that is asking for such an option.

I'm going to have to play more with what you've provided to really see what the code does since I can't tel simply by looking at it. This is where a wiki would be helpful: to explain what each of those variables actually contains, in this case, what $original contains and how it is structured.

The suffusion site, while being a great source to find actions and filters, does not contain any resources for functions. There is no possible way to have guessed how to prepare suffusion_admin_modify_option_list, or how to replace any other function for that matter.

It would also save you the pain of answering the same question over and over... but I know, that takes time that none of us has and I'm sure we'd all rather see updates to the theme than a wiki.
mcfilmmakers
 
Posts: 60
Joined: 28 May 2012, 12:25

Re: How to use suffusion_admin_modify_option_list

Postby sayontan » 24 Jul 2012, 10:19

mcfilmmakers wrote:I'm going to have to play more with what you've provided to really see what the code does since I can't tel simply by looking at it. This is where a wiki would be helpful: to explain what each of those variables actually contains, in this case, what $original contains and how it is structured.

The suffusion site, while being a great source to find actions and filters, does not contain any resources for functions. There is no possible way to have guessed how to prepare suffusion_admin_modify_option_list, or how to replace any other function for that matter.


My friend,
Suffusion is the output of a hobby for me - it isn't something that pays the bills, rather it is something where I invest an obscene amount of time and energy on both, development and support, and a couple of stalwarts (Colin and Drake) pour in hours and hours of their own time on support. A Wiki etc. would be fine if I was charging $50 or more from every user; given that Thesis, the prima donna of paid themes (and woefully short of features in comparison to Suffusion), charges $87 for a single use, $50 per user would seem like the stuff of legend. Charging would also help keep down the support requests quite a lot, and would free up time for things like a better showcase, better documentation etc. But I don't charge, and that is where the story ends.

Filters and actions aren't native to Suffusion: they are core WP features. That is why I don't have expansive literature on how to use them and whatever literature WP provides is more than sufficient. Functions aren't native to WP: they are the tenets of programming in any language. That is why I don't have any "resources" for functions. That is also why I don't have any compendium of functions: each user has a different requirement for what kind of functions they need, and I help on an adhoc basis. WP, a project with hundreds of developers funded by several VCs, itself doesn't have a full list of its action and filter hooks with documentation, so expecting Suffusion, a free theme to hand it to you on a platter is a tad unrealistic. Hooks are considered to be advanced functionality, so the assumption is implicit that if you are playing with hooks you are willing to dig around a bit.

Take a look at this: http://adambrown.info/p/wp_hooks. It is a complete collection of WP hooks. Pick any hook from there, and you will see that the ONLY way to understand what arguments a hook takes is ... to view the source code. The only way to figure out the structure of an argument is to look at the code preceding and succeeding it.

Fundamentally there are the following calls to set up actions and filters:

Code: Select all
add_action('hook_name', 'function_name', 10, 3); // 10 and 3 are the function priority and the number of arguments respectively. See http://codex.wordpress.org/Function_Reference/add_action
add_filter('hook_name', 'function_name', 10, 3); // 10 and 3 are the function priority and the number of arguments respectively. See http://codex.wordpress.org/Function_Reference/add_filter


... And the following to execute the added actions and filters:
Code: Select all
do_action('hook_name', $argument_1, $argument_2, $argument_3); // You pass as many arguments as you have defined in the add_action call. See http://codex.wordpress.org/Function_Reference/do_action
apply_filters('hook_name', $argument_1, $argument_2, $argument_3); // You pass as many arguments as you have defined in the add_filter call. See http://codex.wordpress.org/Function_Reference/apply_filters


Just one thing to note in the above: if you don't have any filters, whatever you have in $argument_1 is returned. So basically your $original variable is what you would like your value to be if there are no changes to it. All this is standard stuff in no way unique to Suffusion, and how the entire WP platform operates.

One gentle nudge: please consider forum rule #4 while you post.
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: How to use suffusion_admin_modify_option_list

Postby mcfilmmakers » 24 Jul 2012, 16:31

I never meant to imply the support is inefficient. Quite the contrary. Like I said, I'd rather see updates than a fancy wiki.

I'm not ignorant of how filters and actions work. I did read the wordpress codex.

However, when something as complex as the theme's hook suffusion_admin_modify_option_list comes along, I don't think it is unreasonable to ask for an explanation on how it works, what arguments it takes, and how to implement it.

I'm not asking for anything remotely specific to any particular website, blog or other situation. I especially don't think it unreasonable to ask considering that not a single other person has been able to even try exploring the function.

Every other answer given, besides your own, was "wait for santoyan".

Your knowledge is vast, your support is amazing, and your help is invaluable. Please don't feel that I, or anyone else takes this for granted. I'm well aware of the amount of work that goes into this!
mcfilmmakers
 
Posts: 60
Joined: 28 May 2012, 12:25

Previous

Return to Support Requests

Who is online

Users browsing this forum: ceveshile, DigitalWINN, Google [Bot] and 4 guests