Forum Replies Created
-
AuthorPosts
-
October 17, 2016 at 1:04 am in reply to: Sub pages Widget, Genesis Simple Sidebars and Buddypress #194870leighmMember
Hi Susan,
Unfortunately, I haven't resolved this issue. Is this the group? - https://sridharkatakam.com/how-to-join-genesis-live-chat-in-slack/
Kind regards,
leighmMemberHi Victor,
Thanks for your reply. It's helped me isolate the source of the problem. I added functionality to allow my client to enter their own featured background image on the homepage. They can do this by going to Appearances > Customize.
To do this I had to create two files in the lib folder, one of them being output.php. There's a function in that file that included this line:
wp_enqueue_style( 'enterprise', get_stylesheet_directory_uri() . '/style.css' );
I removed this line and it removed the reference to the 2nd instance of the style.css file.
Thanks.
April 28, 2016 at 8:19 am in reply to: How do I wrap the "read more link" in a separate paragraph for featured posts? #184602leighmMemberWow, thank you so much, Tonya. That worked perfectly. I only wish I could understand the code!
April 28, 2016 at 2:19 am in reply to: How do I wrap the "read more link" in a separate paragraph for featured posts? #184587leighmMember@Tonya Thanks but the link you sent me to is a paid membership site. Where do I go to see the code snippets?
@Victor Thanks for that code snippet Victor, but I've not been able to adapt it to my project. I'm probably misunderstanding what's going on in this code, but here's my understanding, and how I've tried to adapt it.Your snippet:
// We're adding a filter to the_excerpt part of a post using the vmf_read_more_custom_excerpt function add_filter( 'the_excerpt', 'vmf_read_more_custom_excerpt' ); // The function is taking in 1 agrument, which I'm assuming is the excerpt itself? function vmf_read_more_custom_excerpt( $text ) { // If there's a point in the excerpt that has the ellipses i.e. ... if ( strpos( $text, '[…]') ) { // We create a new bit of text to replace those ellipses? $excerpt = str_replace( '[…]', '<a class="more-link" href="' . get_permalink() . '">[Read More…]</a>', $text ); } else { // not sure what this does? $excerpt = $text; } return $excerpt; }
In my widget I'm using the "Show content limit" option, so I've replaced the_excerpt with the_content_limit, and I've wrapped a div around the Read more link, like this:
add_filter( 'the_content_limit, 'vmf_read_more_custom_excerpt' ); function vmf_read_more_custom_excerpt( $text ) { if ( strpos( $text, '[…]') ) { $excerpt = str_replace( '[…]', '<div><a class="more-link" href="' . get_permalink() . '">[Read More…]</a></div>', $text ); } else { $excerpt = $text; } return $excerpt; }
This code does nothing?
Even if this code did work, wouldn't it just replace what I already have entered into the "More Text" field in the widget, with [Read More...]?
Specifically, I want it to output this html:
<div class="entry-content"><p>This is an example of a WordPress post, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many posts as you like. This … <div class="extra-div"><a href="http://localhost/smcu/the-annul-lunch/" class="more-link">Continue</a></div> </p></div>
Rather than this:
<div class="entry-content"><p>This is an example of a WordPress post, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many posts as you like. This … <a href="http://localhost/smcu/the-annul-lunch/" class="more-link">Continue</a></p></div>
Note that the word "Continue" in the anchor text that I've used in the widget, and this should reflect whatever I put into the widget e.g. it could be Continue reading, more, Read more, Buy now, or any text that I put in there.
Again, I'm most likely not understanding the code fully. Any guidance would be appreciated.
Thanks.
April 27, 2016 at 9:48 am in reply to: How do I wrap the "read more link" in a separate paragraph for featured posts? #184522leighmMemberHi,
I'm quite desperate to find a solution for this. The closest I can get is by using this code:
//* Modify the Genesis content limit read more link add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); function sp_read_more_link() { return '... <a class="more-link" href="' . get_permalink() . '">[Continue Reading]</a>'; }
And modifying it to add a div around the link like this:
//* Modify the Genesis content limit read more link add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); function sp_read_more_link() { return '<div class=link-wrapper-div><a class="more-link" href="' . get_permalink() . '">[Continue Reading]</a><div>'; }
The problem is that I don't want all these buttons to say: [Continue Reading]. Is there a function that I can use in that place to show the actual text that I entered in the widget for More Text. I know you can enter functions in there as I've tested this:
//* Modify the Genesis content limit read more link add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); function sp_read_more_link() { return '<div><a href="' . get_permalink() . '">' . get_permalink() . '</a></div>'; }
And it returns the permalink as the read more text. It would be great if there was a function that tapped into the actual read more text that I've added in the widget.
Any advise much appreciated.
leighmMemberNo problem. Thanks Carasmo. I'll look into myself in the meantime.
leighmMemberThat's perfect, Carasmo. That's exactly what I wanted to do. I wasn't aware that I could echo markup in the function like that. This is my first proper site using Genesis, so still very much on a learning curve. Thanks so much for your help.
On another note: I notice on the sites that you develop, you add a + sign to menu items that have sub items, which is great. Is that a function or how is that done? I hope you don't mind me using your work for inspiration : )
Maybe I should open up a new ticket to ask this specific question?
April 5, 2016 at 2:52 am in reply to: Posted a question but it's disappeared and I can't submit it again #182965leighmMemberThanks Brad. Is that somewhere within this forum? I don't see anything that relates to StudioPress staff.
April 2, 2016 at 6:51 am in reply to: Is it possible to add markup to a section within a widget #182724leighmMemberOk, I was able to do it! So, as I mentioned above I needed to separate each widget into it's own widget area. Before, all 3 widgets were slotted in one after the other and these made up the 3 columns. By creating 3 widget areas, I was able to then add an image widget (using the Image Widget plugin to make it more flexible for the client) to each widget area, and with some css I was able to absolutely position those images relative to the image widget container which happens to be the same width as the widgets below them, so the images are now remaining at the center top of each widget.
April 2, 2016 at 4:09 am in reply to: Is it possible to add markup to a section within a widget #182719leighmMemberYes, and that is exactly the problem I have: when I absolutely position the images, they all line up together in the center of the page. Hense, the need to put the code inside the section, but by the sounds of it, this is pretty complex coding, and most likely beyond me at this stage.
I really like Genesis but it can feel quite restrictive at times!
Thanks anyway for all you help, Brad.
April 2, 2016 at 3:57 am in reply to: Is it possible to add markup to a section within a widget #182716leighmMemberHi Brad, I'm not sure I'm following you. Can you give me a little more detail?
But regardless of whether the images are static or dynamic, I still need to add the markup in a specific position. Is it going to be possible to get markup inside the section tag?
April 2, 2016 at 2:51 am in reply to: Is it possible to add markup to a section within a widget #182713leighmMemberThanks Brad. I just tried the the pseudo element but it won't allow me to add mark up. Just plain text.
In the Enterprise Pro, it has a bottom area that you put 3 widgets in to make up three columns. If I add the first image before the first widget, it just pushes the columns onto a new row, which I don't want. I actually went and built another 3 widget areas, so I could put each widget into one of the new widget areas, and then in the front-page.php where I declare the genesis widget area for each new widget, I added a div just after my opening div. This does allow me to add the image pretty much where I need it. The problem arises because these are circular images (using border radius) and then using absolute positioning so I can float the image above the widget and make sure it stays in the center of the widget as the viewport changes.
I thought it would work, but when I set the image to absolute position 50%, it centers itself in the middle of the 3 widgets not the specific widget that I want it to. Here's the functions:
function enterprise_home_main_feature_col1_widget() { genesis_widget_area( 'home-main-feature-col1', array( 'before' => '<div class="wrap"><div class="home-main-feature-col1 widget-area"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg" class="home-main-feature-col">', 'after' => '</div>', ) ); } function enterprise_home_main_feature_col2_widget() { genesis_widget_area( 'home-main-feature-col2', array( 'before' => '<div class="home-main-feature-col2 widget-area"><div class="home-main-feature-col2 widget-area"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg" class="home-main-feature-col">', 'after' => '</div></div>', ) ); } function enterprise_home_main_feature_col3_widget() { genesis_widget_area( 'home-main-feature-col3', array( 'before' => '<div class="home-main-feature-col3 widget-area"><div class="home-main-feature-col3 widget-area"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg" class="home-main-feature-col">', 'after' => '</div></div></div>', ) ); }
And some of the css:
.home-main-feature-col1, .home-main-feature-col2, .home-main-feature-col3 { position: relative; } .home-main-feature-col { border-radius: 50%; max-width: 140px; position: absolute; margin-left: -70px; top: -129px; left: 50%; border: 10px solid rgb(42, 191, 212); }
I'd send you a screen shot of the design but I don't see anywhere to attach images here.
Thanks Brad.
April 2, 2016 at 2:12 am in reply to: Is it possible to add markup to a section within a widget #182708leighmMemberBrad, I did a search for creating custom fields and found your tutorial here: http://wpsites.net/web-design/how-to-create-a-custom-field/. It's a very good tutorial, but I'm unsure how I could use this in my situation. The content I'm trying to add to is contained within widgets, and one of them is a plugin widget. How can I inject markup into such specific areas of the page?
Can you explain further what you mean about filters? I'm not following that part at all.
Unfortunately, I'm working locally on this site, so I can't share it with you right now, but here's the code for the 3 widgets in question.
Widget 1: Event List
<section id="event_list_widget-3" class="widget widget_event_list_widget"><div class="widget-wrap"><h4 class="widget-title widgettitle">Upcoming events:</h4> <div class="event-list"> <ul class="event-list-view"> <li class="event smcu-yearl-events"> <div class="event-date"><div class="start-date"><div class="event-weekday">Fri</div><div class="event-day">27</div><div class="event-month">May</div><div class="event-year">2016</div></div></div> <div class="event-info single-day"><div class="event-title"><h3>The Golf Outing</h3></div><span class="event-time">9:00 am</span></div> </li> <li class="event smcu-yearl-events"> <div class="event-date"><div class="start-date"><div class="event-weekday">Thu</div><div class="event-day">16</div><div class="event-month">Jun</div><div class="event-year">2016</div></div></div> <div class="event-info single-day"><div class="event-title"><h3>The Annual Lunch</h3></div><span class="event-time">8:00 pm</span></div> </li></ul> </div></div></section>
And I want to be able to add a div just inside the the opening section tag like this:
<section id="event_list_widget-3" class="widget widget_event_list_widget"><div class="home-main-feature-col1 widget-area"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg" class="home-main-feature-col" /></div><div class="widget-wrap"><h4 class="widget-title widgettitle">Upcoming events:</h4> <div class="event-list"> <ul class="event-list-view"> <li class="event smcu-yearl-events"> <div class="event-date"><div class="start-date"><div class="event-weekday">Fri</div><div class="event-day">27</div><div class="event-month">May</div><div class="event-year">2016</div></div></div> <div class="event-info single-day"><div class="event-title"><h3>The Golf Outing</h3></div><span class="event-time">9:00 am</span></div> </li> <li class="event smcu-yearl-events"> <div class="event-date"><div class="start-date"><div class="event-weekday">Thu</div><div class="event-day">16</div><div class="event-month">Jun</div><div class="event-year">2016</div></div></div> <div class="event-info single-day"><div class="event-title"><h3>The Annual Lunch</h3></div><span class="event-time">8:00 pm</span></div> </li></ul> </div></div></div></section>
Widget 2: Recent posts
<section id="recent-posts-4" class="widget widget_recent_entries"><div class="widget-wrap"> <h4 class="widget-title widgettitle">Posts</h4> <ul> <li> <a href="http://localhost/smcu/the-annul-lunch/">The Annul Lunch</a> </li> <li> <a href="http://localhost/smcu/the-golf-outing/">The Golf Outing</a> </li> <li> <a href="http://localhost/smcu/annual-dinner/">Annual Dinner</a> </li> <li> <a href="http://localhost/smcu/hello-world/">Hello world!</a> </li> <li> <a href="http://localhost/smcu/threaded-comments/">Sample Post With Threaded Comments</a> </li> </ul> </div></section>
Again, I want to put a div after the opening section tag like this:
<section id="recent-posts-4" class="widget widget_recent_entries"><div class="home-main-feature-col2 widget-area"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg" class="home-main-feature-col" /></div><div class="widget-wrap"> <h4 class="widget-title widgettitle">Posts</h4> <ul> <li> <a href="http://localhost/smcu/the-annul-lunch/">The Annul Lunch</a> </li> <li> <a href="http://localhost/smcu/the-golf-outing/">The Golf Outing</a> </li> <li> <a href="http://localhost/smcu/annual-dinner/">Annual Dinner</a> </li> <li> <a href="http://localhost/smcu/hello-world/">Hello world!</a> </li> <li> <a href="http://localhost/smcu/threaded-comments/">Sample Post With Threaded Comments</a> </li> </ul> </div></section>
Widget 3: Featured Page: I know I can use the featured image in the widget settings but just wanted to show that I'm trying to achieve the same thing here.
<section id="featured-page-4" class="widget featured-content featuredpage"><div class="widget-wrap"><article class="post-456 page type-page status-publish has-post-thumbnail entry"><a href="http://localhost/smcu/development/" class="alignnone" aria-hidden="true"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg" class="entry-image attachment-page" alt="Development" itemprop="image" srcset="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg 150w, http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg 300w" sizes="(max-width: 300px) 100vw, 300px" height="300" width="300" /></a><header class="entry-header"><h2 class="entry-title"><a href="http://localhost/smcu/development/">Development</a></h2></header><div class="entry-content"><p>This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages as you like and manage all of your content inside of WordPress. This is</p></div></article></div></section>
The same again:
<section id="featured-page-4" class="widget featured-content featuredpage"><div class="home-main-feature-col3 widget-area"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg" class="home-main-feature-col" /></div><div class="widget-wrap"><article class="post-456 page type-page status-publish has-post-thumbnail entry"><a href="http://localhost/smcu/development/" class="alignnone" aria-hidden="true"><img src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg" class="entry-image attachment-page" alt="Development" itemprop="image" srcset="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg 150w, http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg 300w" sizes="(max-width: 300px) 100vw, 300px" height="300" width="300" /></a><header class="entry-header"><h2 class="entry-title"><a href="http://localhost/smcu/development/">Development</a></h2></header><div class="entry-content"><p>This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages as you like and manage all of your content inside of WordPress. This is</p></div></article></div></section>
Thanks Brad.
April 1, 2016 at 10:38 am in reply to: Is it possible to add markup to a section within a widget #182669leighmMemberThanks for the link Brad.
It's a random image for the event widget. For the recent posts, potentially I'd image I could use one of the featured images but that would mean we'd need to ensure that every post gets a featured image, which I can't guarantee. The last widget is a featured page, and it will always remain the same so a featured image would work in this case.
April 1, 2016 at 10:07 am in reply to: Is it possible to add markup to a section within a widget #182667leighmMemberHi Brad, there 3 widgets (in 1 column). One is a plugin: Event List. The other2 are recent posts and featured page. I want to add an image to the top of each.
How do I know if a widget includes a filter? And how would I go about altering that way?
Could you direct me to any tutorials or snippets that discuss creating a custom widget?
Thanks.
April 1, 2016 at 3:32 am in reply to: Featured image centering problem when I override the alignment class for mobile #182634leighmMemberHi Joyce,
Thanks for your reply. Unfortunately, I'm working on this locally, so can't show you the site.
When I target that a tag with text-align, it doesn't work. However, if I wrap that a tag in a div and text align that div to center, it works.
This doesn't work:
<a style="float: none;" href="http://localhost/smcu/threaded-comments/" class="alignleft" aria-hidden="true"><img style="" src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg" class="entry-image attachment-post" alt="Sample Post With Threaded Comments" itemprop="image" srcset="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg 150w, http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg 300w" sizes="(max-width: 300px) 100vw, 300px" height="300" width="300"></a>
This does:
<div style="text-align: center;"><a style="float: none;" href="http://localhost/smcu/threaded-comments/" class="alignleft" aria-hidden="true"><img style="" src="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg" class="entry-image attachment-post" alt="Sample Post With Threaded Comments" itemprop="image" srcset="http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test-150x150.jpg 150w, http://localhost/smcu/wp-content/uploads/2013/05/circle-image-test.jpg 300w" sizes="(max-width: 300px) 100vw, 300px" height="300" width="300"></a><div>
So, is there any way for me to edit the mark up so that I can wrap the a tag in div?
Thanks.
March 26, 2016 at 2:58 am in reply to: How to show only sub categories on a category page in the sidebar? #182266leighmMemberThanks a lot for your patience with my question. Obviously, I had the terminology wrong. I was thinking of pages as categories and their child pages as subcategories (which seemed logical enough to me) but I can see now that those terms relate exclusively to posts.
That plugin (https://wordpress.org/plugins/be-subpages-widget/) is exactly what I was looking for. I did a lot of searching but never found it. Again, probably using the wrong search terms.
Thanks again.
Leigh
March 25, 2016 at 9:47 am in reply to: How to show only sub categories on a category page in the sidebar? #182233leighmMember@carasmo Ok, I'm confused, so are you saying that I don't need to create a custom sidebar template, and I should put this code into the functions file? I had done this earlier and Brad had indicated that it was the right way to do it?
@braddalton Thanks for that video Brad. Although, that deals with blog posts. I'm trying to display subcategories of pages. Carasmo has indicated that there are no subcategories for pages, but when I add a page I'm able to assign it to a parent. Is that not the same as a subcategory? The video points to your wpsites.net but I have to pay to get access to it. Does being a member of StudioPress not give me access to this code?Thanks.
March 24, 2016 at 11:34 am in reply to: How to show only sub categories on a category page in the sidebar? #182172leighmMemberThanks Carasmo. I tried adding your test code to my custom sidebar, but nothing shows up at all? It does work if I add it to functions.php
Also, I noticed that when my custom file is active, the page shows the blog post twice?
Brad, I found this updated code on: http://www.wpbeginner.com/wp-tutorials/display-subcategories-on-category-pages-in-wordpress/. So, my function looks like this:
function enterprise_sidebar_control_categories() { if (is_category()) { $this_category = get_category($cat); } if($this_category->category_parent) { $this_category = wp_list_categories('orderby=id&show_count=0 &title_li=&use_desc_for_title=1&child_of='.$this_category->category_parent. "&echo=0"); } else { $this_category = wp_list_categories('orderby=id&show_count=0 &title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID. "&echo=0"); } if ($this_category) { echo "<ul>"; echo $this_category; echo "</ul>"; } }
But it still doesn't work.
If I add it to functions.php, it shows all the post categories and subcategories. So, I don't think the code is doing what it should. Specifically, I'd like this to work on pages not posts, and show the subcategories (and the parent) of any page the user is on.
I've had a look at some plugins but can't find one that does this. Any recommendations?
Thanks,
Leigh
March 24, 2016 at 2:47 am in reply to: How to show only sub categories on a category page in the sidebar? #182152leighmMemberHi Brad,
I can write some code, but this is the first time I've used Genesis, and as we can't just go and edit the framework, I'm unsure of where we put custom code. And I really want to learn how to do this. This is what I've attempted. I've copied the sidebar.php file from the Genesis framework into my child theme (Enterprise Pro), and added this code:
// I'm hoping that this will execute my function in the correct place? add_action( 'genesis_sidebar', 'enterprise_sidebar_control_categories' ); // should work out what category page I'm on and display only subcategories from that categories? function enterprise_sidebar_control_categories() { if (is_category()) { $this_category = get_category($cat); if (get_category_children($this_category->cat_ID) != "") { echo "<h1>Subcategories</h1>"; echo "<ul>"; wp_list_categories('orderby=id&show_count=0&title_li= &use_desc_for_title=1&child_of='.$this_category->cat_ID); echo "</ul>"; } } }
However, this code did not work for me. Nothing changes. Firstly, am I hooking the function in at the right place? And if so, is the code snippet the correct one to achieve what I'm looking to do.
Any help you can offer would be greatly appreciated? Or if you know of any resources that deal with creating custom templates, that would be great.
Thanks,
Leigh
-
AuthorPosts