Community Forums › Forums › Archived Forums › General Discussion › Genesis – documentation and principles
Tagged: archive, documentation, genesis, support
- This topic has 8 replies, 2 voices, and was last updated 8 years, 7 months ago by
silver darling.
-
AuthorPosts
-
January 29, 2015 at 2:47 pm #138983
silver darling
MemberHi
Please excuse any newbie frustration here, my first time using Genesis so i maybe i'm missing, or not understanding (php/ genesis/wordpress), something obvious.
Where is the full documentation for genesis?
i can find code snippets - http://my.studiopress.com/snippets/ , very useful but obviously not exhaustive
i can see a hook reference - http://my.studiopress.com/docs/hook-reference/ is this the full list?
and a filter reference - http://my.studiopress.com/docs/filter-reference/ is this the full list?
and a short code reference http://my.studiopress.com/docs/shortcode-reference/ i know this is not a full listWhere can i find a list of short codes or lists of arguments i can pass to functions? E.g. this snippets page lists shortcodes [ ] for breadcrumbs in an example http://my.studiopress.com/snippets/breadcrumbs/ . But is this the full list? What about other shortcodes that can be used in other filters, where are the docs for these? Should i be raking through examples across the web trying to strike it lucky or is there one place to find a full reference? Is that the same with actions, filters and hooks?
I can look through the genesis code and see various functions. In general, can i refer to any of these functions in actions or filters? I've tried this but it doesn't seem to work.
I was trying to change the html output on archive headers (h1), so i asked paid for support. the answer i got back was the same as i'd found on the web - Gary Jones - http://docs.garyjones.co.uk/genesis/2.0.0/ . Is Gary's reference site the go to place for docs?
I asked paid for support if there was an action or filter to change archive html output. They said 'yes there is' BUT would not tell me what it was (beyond scope of support apparently). My impression was that they knew less than me and i don't know much. what sort of paid for support refuses to provide info on (what to me anyway) is core functionality?
Is there a general approach to getting info on genesis? Or am i expecting to find functionality and info that isn't actually there?
At present my experience with genesis is mixed. I kind of like it but at this stage it would be much more productive for me to just hack up a standard theme and grab some plugins. Because of poor documentation (to me anyway) I would not recommend genesis without considerable reservations.
Hopefully someone can help clear up my misconceptions,
thanks
http://my.studiopress.com/
ianJanuary 31, 2015 at 5:18 am #139131Carlo
MemberHi Ian. I agree that the documentation on the studiopress website is not as good as it could be. There are shortcodes, hooks, actions and filters that do exist but are not covered in the reference.
Usually, I look through the source code to find filters, actions and shortcodes to use. You can find them by looking for code according to the following formats:
Filters:
apply_filters( 'name_of_filter', $content_to_be_filtered );
Actions:
do_action( 'name_of_action' );
Shortcodes:
add_shortcode( 'name_of_shortcode', 'callback_function' );
Of course, knowing where to look is a skill that you have to develop with practice.
I should probably be able to help you with changing archive html output. Can you explain in more detail what you need to do?
January 31, 2015 at 7:35 am #139156silver darling
MemberThanks Carlo, that helps me see genesis more clearly, much appreciated. Studiopress, maybe you should think about a) producing good documentation and b) adding what Carlo says above to your genesis 'how to'.
My problem is changing the class attribute on the h1 tag:
/wp-content/themes/genesis/lib/structure/archive.php line 50 $headline = sprintf( '<h1 class="archive-title">%s</h1>', strip_tags( $term->meta['headline'] ) );
I want to change class="archive-title" to class="myclass" . I know I could change the h1 styling by hacking the CSS but for clarity and learning 'how to' I would rather hack the php.
Any pointers to how to do that would be very welcome.
cheers
ianFebruary 1, 2015 at 6:51 am #139248Carlo
MemberHi Ian. Try adding this code to your theme functions and let me know if it works:
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); add_action( 'genesis_before_loop, function() { ob_start(); genesis_do_taxonomy_title_description(); $output = ob_get_clean(); echo str_replace( 'class="archive-title"', 'class="myclass"', $output ); }, 15 );
February 1, 2015 at 11:40 am #139293silver darling
Membercheers Carlo,
Thanks for your time but this doesn't seem to work for me. I am a junior php coder but if i test with
... ob_start(); genesis_do_taxonomy_title_description(); $output = ob_get_clean(); var_dump($output); // returns: string(0) "" ...
if i test directly on an archive template with
global $wpdb; //not sure if this needed $tester = genesis_do_taxonomy_title_description(); var_dump ($tester); // returns: NULL
From what i understand genesis_do_taxonomy_title_description() isn't outputting anything, but i'm stuck at what to pass to this function to get some output.
shame because it looked like your code would be useful to modify a lot of genesis function output.
Thanks
ianFebruary 2, 2015 at 5:19 am #139370Carlo
MemberSorry Ian. I missed closing a string.
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); add_action( 'genesis_before_loop', function() { ob_start(); genesis_do_taxonomy_title_description(); $output = ob_get_clean(); echo str_replace( 'class="archive-title"', 'class="myclass"', $output ); }, 15 );
Also make sure that you're viewing a category or tag template, and that you have set a headline for that category or tag.
February 2, 2015 at 6:10 am #139372silver darling
Memberthanks Carlo,
i had spotted and fixed the unclosed string ' before but that wasn't the problem.
if i dump $output from within your function
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); add_action( 'genesis_before_loop', function() { ob_start(); genesis_do_taxonomy_title_description(); $output = ob_get_clean(); var_dump($output); echo str_replace( 'class="archive-title"', 'class="myclass"', $output ); }, 15 );
it returns
string(0) ""
.I think the problem is that genesis_do_taxonomy_title_description() needs something passed to it but i have no idea what.
cheers
ianFebruary 3, 2015 at 5:24 am #139500Carlo
MemberI think the problem is that genesis_do_taxonomy_title_description() needs something passed to it but i have no idea what.
No, that's not the problem. I tested it on my own offline site and it works.
If you're not getting it to work, it's either because you're not viewing a category or tag template, or that you haven't set a Genesis headline for that category or tag.
February 3, 2015 at 1:14 pm #139538silver darling
Memberok Carlo, thanks for staying with me. As you say your code below DOES work for CATEGORY or TAG archive -
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); add_action( 'genesis_before_loop', function() { ob_start(); genesis_do_taxonomy_title_description(); $output = ob_get_clean(); echo str_replace( 'class="archive-title"', 'class="myclass"', $output ); }, 15 );
I've been trying to change output on a CUSTOM POST TYPE archive. So i'd blinded your check tag or category archive direction because i was looking at a custom post type archive .. sorry, takes some of us a bit of time and support before it clicks .. So code below will change output for a CPT archive -
remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description'); add_action( 'genesis_before_loop', function() { ob_start(); genesis_do_cpt_archive_title_description(); //archive.php line 118 $output = ob_get_clean(); echo str_replace( 'class="archive-title"', 'class="myclass"', $output ); }, 10 );
http://soldnetwork.org.uk/resources/
And you've given very useful and adaptable code. Thank you for your time, i've learned a lot there.
cheers
ian -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.