Forum Replies Created
-
AuthorPosts
-
March 19, 2016 at 6:25 am in reply to: How do I output the returned value of a function that uses an earlier hook? #181842
simbasounds
MemberJust to wrap this up: I solved my specific issue by using globalised variables to pass values between action hook functions.
March 14, 2016 at 12:39 am in reply to: How do I output the returned value of a function that uses an earlier hook? #181381simbasounds
Memberre. "Nothing within the head tags display on the page. You should also wrap the content in meta tags or something that won't cause a HTML validation error, otherwise you will not be able to reuse its content anywhere else on the page."
Actually it does display when used in wp_head, but in any case it's just a temporary test so validation doesn't matter at this stage. I'm simply using those hooks as a sort of console.log. I inspect the page source to see if the hook output or not.re. "Maybe if you can be more specific with your requirements, we can provide a definitive answer."
As I said, I will create a more generic example for this forum - which I value highly - to answer my original question. Thanks for your eagerness to help, Victor. I really appreciate it. I'll do some testing in my own time and be back with a better question, perhaps an answer too.March 13, 2016 at 10:44 am in reply to: How do I output the returned value of a function that uses an earlier hook? #181351simbasounds
Member..hence my question: How do I output the returned value of a function that uses an earlier hook?
March 13, 2016 at 9:38 am in reply to: How do I output the returned value of a function that uses an earlier hook? #181345simbasounds
MemberHi Victor,
Thanks for responding. I can confirm the dynamik_has_label function is returning true, or at least in the case of:
add_action( 'wp_head', 'echo_source' ); function echo_source() { echo page_source(); }
ie. it works on the page where the "test" label is active, hooked into wp_head, but not genesis_footer.
I probably made my question a little too open to ambiguity by phrasing it in the context of the Dynamik Website Builder. Ideally, and especially in the case of Stack Exchange I should probably have limited it to WordPress functions.
I'm going to wait and see what CobaltApps say about this specific case, then reply with their answer.
Then time-permitting, see if I can create a more generic example to answer my original question.simbasounds
MemberBump this suggestion. Simple Sidebars should ideally add a unique ID or class to the whole sidebar div.
In line 102 of the plugin it is registered missing a 'class' parameter.
//* Cycle through created sidebars, register them as widget areas foreach ( (array) $_sidebars as $id => $info ) { genesis_register_sidebar( array( 'name' => esc_html( $info['name'] ), 'id' => $id, 'description' => esc_html( $info['description'] ), 'editable' => 1, ) ); }
Not that it would help: according to the codex - Function Reference/register sidebar "This class will only appear in the source of the WordPress Widget admin page. It will not be included in the frontend of your website."
So I guess it could add a body class? eg. .ssidebar-my-sidebar-id
simbasounds
MemberCoincidentally the project I'm working on now has this requirement again, so big thanks, Christoph!
simbasounds
MemberThanks Susan, yes I understand that. I simply meant in a general sense that if someone had the same issue they could come here and find the answer, seeing as it's probably something that people would need ie. the ability to have comments in a blog archive. No pressure whatsoever : ) Most humbly grateful to the volunteers..
simbasounds
MemberI can't even remember what this was for, but no, I don't think I managed to solve it.
If the forum is to be considered a resource of knowledge, then it should probably be answered.
ThanksJanuary 24, 2015 at 3:22 pm in reply to: Display Excerpt instead of content in CPT archive with genesis_custom_loop #138550simbasounds
MemberGreat : ) thanks
Hopefully I'll get a chance to test-drive it soon..January 24, 2015 at 2:41 pm in reply to: Display Excerpt instead of content in CPT archive with genesis_custom_loop #138544simbasounds
MemberHi Ren, thanks for replying.
I no longer need this functionality on my current project, but it's worth clearing up for future reference.I already have Theme Settings set for normal post archives.
What if I wanted different settings for CPTs?I imagine it would be something like the following in my CPT archive custom loop (although I don't recall if it worked or not):
remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); add_action('genesis_entry_content', 'custom_content'); function custom_content() { if (has_excerpt( $post->ID )) { the_excerpt(); } else { the_content(); } }
simbasounds
MemberHi Susan,
It's been a while, but I think I managed to work around it.
So no, as the question stands it isn't resolved, but I don't need to escalate it either.As a general question, the answer - if / when it comes - may be useful to someone.
In cases like these do we close threads or leave them open?(As a separate issue I'm no longer receiving follow-up emails, so I only spotted your reply by accident).
simbasounds
MemberThanks so much Ren. In functions.php I used:
add_action( 'pre_get_posts', 'set_cat_tax_args' ); function set_cat_tax_args( $query ) { if ($query->is_tax('charity-category')) { $query->set( 'orderby','rand' ); $query->set( 'posts_per_page', -1 ); } }
And it's working!
simbasounds
MemberOk, so this wasn't a Genesis or Simple Sidebars issue, rather an issue with the way I coded a shortcode in the widget.
The solution came down to wrapping the shortcode html:ob_start(); // html here return ob_get_clean();
simbasounds
MemberThanks Lorraine, I did manage to work around it, yes, by modifying the jQuery to target the widget ids.
simbasounds
MemberI eventually ended up implementing this on my own site by installing the ShadowBox plugin:
In my archive-portfolio.php I used a rel="shadowbox" link on my image block post links:
add_action('genesis_entry_content', 'post_thumbnail'); function post_thumbnail() { if ( has_post_thumbnail() ) { ?> <a href="<?php echo get_page_link(); ?>" rel="shadowbox"> <?php the_post_thumbnail( $size, $attr ); ?> </a> <?php } }
This makes the links open the post in an iframe lightbox.
But the posts in the iframe lightbox had a duplicate header and navigation. Since the posts needed to be able to open as stand-alone posts - say, if linked-to from a Google search - I couldn't remove the duplicate site structure markup with php. They needed to to be hidden using CSS display:none only in the iframe.
This was achieved by using a script which detects if the post is inside the iframe, and hides structural elements accordingly:
<script type='text/javascript'> if (self !== top) document.write('<style type="text/css"> .site-header,.site-container .nav-primary,.site-container .responsive-primary-menu-container,.site-footer {display: none;}</style>'); </script>
Here's the result:
http://simonbarnett.co.za/portfolio/There's an additional issue in that links inside the iframe posts need to open in the full browser window. Currently they open inside the lightbox. The links will need to be filtered to have target="_top". In most cases the archive-portfolio.php can be modified, but I think Genesis uses a custom function for taxonomy links because this doesn't work:
function change_target($result) { $result = str_replace('<a', '<a target="_top"', $result); return $result; } add_filter('wp_list_categories', 'change_target'); add_filter('the_category', 'change_target');
I'll start a new thread for this query.
simbasounds
MemberThanks, will give it a go..
simbasounds
MemberThanks Gary. It seems more logical to me that multiple classes should be supported for CPT archives since they are supported for single CPTs and standard WordPress pages and single posts.
My intended usage was to give users of a child theme or Dynamik skin the option of tagging any page, post, single CPT or archive certain functionality like full-width-page or sidebar-header, or both, by using body classes. So far I'm working around it by making extra combined classes with combined attributes, so there's no urgency.
simbasounds
MemberI set up a test site with default Genesis + Genesis Sample child theme.
I used the members CPT code with support for 'genesis-cpt-archives-settings'.After updating permalinks I added two body classes to the archive settings:
As shown in this screenshot of the source of the archive page it's concatenating the classes:
I'll contact support and see what they say..
simbasounds
MemberNo, HTML5. I think the hook is fine. I've been using it on many of my sites.
I tried changing it to genesis_entry_content to see if it has anything to do with that body class space bug, but the bug remained.simbasounds
MemberOk, I've cleaned it all up, including using the simpler CPT code.
Looking more closely it seems that the problem is that for CPT archives it removes the space between classes.
So if I enterfullwidth sideheader
it adds a body class of fullwidthsideheader.
I also triedfullwidth%20sideheader
and evenfullwidth %20 sideheader
, but it still removes the encoded space.It's not ideal, but if there's no obvious fix I'm happy to use work-arounds.
-
AuthorPosts