SunnyOz
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: PageNavi plugin and custom post display – gives /page/2/ not foundThanks for your advice @joyously.
I am not sure I understand all that you wrote, but I did go change the settings/reading max posts to 1 – as a test, and the pagination did work. Thanks for the tip.
The code I displayed was used because it was suggested as a fix for the pagination problem. I have now gone back to my oy original code, and it works also. It probably is breaking WP rules also, so I will post the entire page here for you to see.
Note: I am pulling in a widget ahead of the query that displays my blog posts. This widget has an image and some text to introduce the posts.
<?php get_header(); ?> <div class="container blog-posts margin-bottom-50"> <div class="row"> <h1 style="margin-top: 65px;"> <?php wp_title( '' ); ?>home </h1> <div class="container"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <?php if ( dynamic_sidebar ( 'front-blog' ) ); ?> </div> </div> </div> <br clear="all" /> <?php $paged = (get_query_var( 'paged' )) ? get_query_var( 'paged' ) : 1; $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'order'=> 'DESC', 'orderby' => 'post_date', 'category_name' => 'Recipes', 'posts_per_page' => 1, 'paged' => $paged, ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 home-blog-list" style="float: left; display:block"> <center><div class="img-responsive box-shadow shadow-effect" style=""><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div> <h3 class="entry-title script" style="text-align: center;"><a class="entry-title-link" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3><center> </div> <?php endforeach; ?> <?php wp_pagenavi(); ?> <br clear="all" /> </div> </div> <div class="container" style="text-align: center; margin: 0 auto;"> <img class="img-responsive" src="<?php bloginfo( 'template_directory' ); ?>/images/curly-divider-red.png" style="text-align: center; margin: 0 auto;"> </div> <br /> <div class="container"> <div class="row"> <div class="col-md-12"> <h4 class="blog-search">Can't find what you are looking for? Use the search form below to search the site!</h4> <div class="search-form-container"> <?php get_search_form(); ?> </div> </div> </div> <?php get_footer(); ?>
Since I can now see what is being displayed on subsequent pages of the blog posts page… I see that the widget is being displayed on each page (as you would expect.) However, I think I would prefer to only show this on page 1, and if there are subsequent pages, to also display which page it is after the title.. as in something like this:
If page one: display title, and display widget
If not page one: display title with pagination number, and don’t display widget.Is this even possible? Can you help me with the code that would do both of these things?
Thanks,
SunnyOzForum: Fixing WordPress
In reply to: Can you edit the Posts Page through the Admin panelThanks again @joyously for being so quick to respond.
Sorry, but I am not really a WordPress expert… so I am not sure what the net results is of your statements.
Just FYI: I did try doing two different sets of queries – one for the blog posts, and one for the page content. That’s what I am asking help for in writing the php to get both types of information.
However, maybe you are really just saying that I can’t really do that – because that blog page is not setup to function like a normal page. And even if it was possible, it won’t work because there is also a bug when you try to view it. Is that correct?
So, the net is that I should just be happy with my widget solution? (It does work well that way, I only wanted to know if what I was trying to do with the blog page was something that could be done.)
Cheers,
DawnThanks for the advice @joyously.
I did as you suggested, and didn’t try the grid solution.. too onerous!
In the end, I just added a class to the div and some css, and it worked like a charm. (I also fixed the order and order by parameters).
To just document the resulting code I use for people searching for the same thing, here is the end result:
<div class="container blog-posts margin-bottom-50"> <div class="row"> <h1 style="margin-top: 65px;"> <?php wp_title( '' ); ?> </h1> <?php $args = array( 'posts_per_page'=>-1, 'order'=> 'DESC', 'orderby' => 'post_date', 'post_status' => array( 'publish') ); $postslist = get_posts( $args ); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 home-blog-list" style="float: left; display:block"> <center><div class="img-responsive" style=""><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div> <h3 class="entry-title" style="text-align: center;"><a class="entry-title-link" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3><center> </div> <?php endforeach; ?> <!-- note: change 'posts_per_page'=>-1 to 'numberposts' => 9 to go back to only displaying 9 per page --> <br clear="all" /> </div> </div>
div.img-responsive a img.wp-post-image { max-width: 100%; height: auto; align: center; } div.home-blog-list { padding-left: 5px; padding-right: 0px; }
Forum: Fixing WordPress
In reply to: Can’t add new or remove old widgetsThanks for your quick reply @joyously.
I guess I am a bit confused at how you stated the corrections.. but I will take the advice of someone who is more experienced than I.
Note: I miss-typed the name of the home page.. you were right.. it is called: front-page.php.
Since I am creating the website and content initially for the whole site, I will be creating the new widgets via function.php page. And I will be (instead of the user) be filling in the content of the widgets.. at least first time around. I agree in most cases, the widgets are used in the sidebar, but the one I am trying to add is going be be pulled into my home page. Since the home page is a static page, it is setup to use the font-page.php page as it’s page template.. hence the reason I am calling the widget from that page.
The code I gave you has worked fine for several websites I have created using this same based template. You can see the website I used as a base here: oasisflighttraining.com.au – . If you look at the bottom of that home page (just before the footer), you will see 3 clickable images. They are all in their own widget area.. and they are called there from the front-page.php page. (These 3 widgets are actually the ones I am trying to remove for the new website.. at the same time trying to add a new / different widget to the home page.) Those 3 widgets were defined with a similar create statement in the function.php page..and that worked as it should, creating the ‘shell’ of the widget to be available for customisation in the admin area. The code that displayed those three widgets on the home page were written as follows:
FRONT-PAGE.PHP:
<div class="container"> <div class="row"> <div class="col-md-4 col-sm-4 col-xs-12"> <div class="thumbnail-kenburn thumbnail-kenburnl"> <?php if ( dynamic_sidebar ( 'front-left' ) ); ?> </div> </div> <div class="col-md-4 col-sm-4 col-xs-12"> <div class="thumbnail-kenburn thumbnail-kenburnc"> <?php if ( dynamic_sidebar ( 'front-center' ) ); ?> </div> </div> <div class="col-md-4 col-sm-4 col-xs-12"> <div class="thumbnail-kenburn thumbnail-kenburnr"> <?php if ( dynamic_sidebar ( 'front-right' ) ); ?> </div> </div> </div>
I know you are saying that the code isn’t correct.. yet it does call in the correct widgets as defined in the function.php file.
I don’t see an action hook in the Oasis site’s function.php.. this one does work.. so I am not sure how it does what it does? I’ll display the entire file so maybe you can see where the action call might be??
FUNCTION.PHP:
<?php function theme_styles() { wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' ); wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' ); } add_action( 'wp_enqueue_scripts', 'theme_styles' ); function theme_js() { global $wp_scripts; wp_register_script( 'html5_shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', "", "", false ); wp_register_script( 'respond_js', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', "", "", false ); $wp_scripts->add_data( 'html5_shiv', 'conditional', 'lt IE 9' ); $wp_scripts->add_data( 'respond_js', 'conditional', 'lt IE 9' ); wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true ); wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery', 'bootstrap_js'), '', true ); wp_enqueue_script( 'stickynav_js', get_template_directory_uri() . '/js/stickynav.js', array('jquery'), '', true ); } add_action( 'wp_enqueue_scripts', 'theme_js', 'stickynav_js' ); //add_filter( 'show_admin_bar', '__return_false' ); add_theme_support( 'menus' ); add_theme_support( 'post-thumbnails' ); function register_theme_menus() { register_nav_menus( array ( 'header-menu' => __( 'Header Menu' ) ) ); } add_action( 'init', 'register_theme_menus' ); add_action( 'init', 'my_add_excerpts_to_pages' ); function my_add_excerpts_to_pages() { add_post_type_support( 'page', 'excerpt' ); } function create_widget( $name, $id, $description, $beforewidget, $beforetitle, $aftertitle ) { register_sidebar(array( 'name' => __( $name ), 'id' => $id, 'description' => __( $description ), 'before_widget' => $beforewidget, 'after_widget' => '</div>', 'before_title' => $beforetitle, 'after_title' => $aftertitle, )); } create_widget( 'Front Page Left', 'front-left', 'Displays on the left of the homepage', '<div class="widget">', '<h3>', '</h3>' ); create_widget( 'Front Page Center', 'front-center', 'Displays in the center of the homepage', '<div class="widget">', '<h3>', '</h3>' ); create_widget( 'Front Page Right', 'front-right', 'Displays on the right of the homepage', '<div class="widget">', '<h3>', '</h3>' ); create_widget( 'Front Page Sidebar', 'front-side', 'Displays sidebar after header image', '<div class="widget sider">', '<div class="headline"><h3>', '</h3></div>' ); create_widget( 'Footer Left', 'footer-left', 'Displays on the left of the footer', '<div class="widget">', '<h2>', '</h2>' ); create_widget( 'Footer Center', 'footer-center', 'Displays in the center of the footer', '<div class="widget">', '<h2>', '</h2>' ); create_widget( 'Footer Right', 'footer-right', 'Displays on the right of the footer', '<div class="widget">', '<h2>', '</h2>' ); create_widget( 'Page Sidebar', 'page', 'Displays on the side of pages with a sidebar', '<div class="widget blog-twitter">', '<div class="headline"><h3>', '</h3></div>' ); create_widget( 'Page Sidebar contact', 'page2', 'Displays on the side of pages with a sidebar with contact button', '<div class="widget">', '<h3>', '</h3>' ); create_widget( 'Page Sidebar short', 'short-testimonial', 'Displays on the side of short pages', '<div class="widget blog-twitter">', '<div class="headline"><h3>', '</h3></div>' ); create_widget( 'Page Sidebar about', 'about-side', 'Displays on the side of the About page', '<div class="widget">', '<h3>', '</h3><br /><br />' ); create_widget( 'Page Sidebar theory', 'theory-side', 'Displays on the side of the Aviation Theory page', '<div class="widget">', '<h3>', '</h3><br /><br />' ); create_widget( 'Page Sidebar trial', 'trial-side', 'Displays on the side of the Trial Introductory Flight page', '<div class="widget">', '<h3>', '</h3><br /><br />' ); create_widget( 'Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section', '<div class="widget">', '<h3>', '</h3>' ); create_widget( 'Off-Canvas Sidebar', 'offcanvas', 'Displays on the side of pages with an off-canvas sidebar', '<div class="widget">', '<h3>', '</h3>' ); function ninja_forms_add_nf_styles( $form_id ) { if( $form_id == 1 ) { // echo '<style> // .ninja-forms-form-wrap{background:red} // </style>'; wp_enqueue_style( 'ninja_forms-nf-css', get_template_directory_uri() . '/css/ninja_forms.css' ); } } add_action ( 'ninja_forms_display_css', 'ninja_forms_add_nf_styles' ); ?>
So why does this code work for the Oasis site.. and not for the new site. They both have the same code structure.
Can you give me any insight in how to fix the new site?
Thanks,
SunnyOz- This reply was modified 5 years, 1 month ago by SunnyOz. Reason: tried to provide link to website referenced
Forum: Localhost Installs
In reply to: Changing PHP version once uploaded to server from localhostThank you very much @catacaustic for your quick reply. I just checked my server, and I can change the php version via my control panel. They have options for 5.2, 5.3, 5.4, 5.5, 5.6 & 7.
Is there any problem with changing the version to 7, and if there are functional issues with my WordPress site, changing it back to the older version (ie: 5.3)? Is there any prep before hand needed on the site? Or on the server? Or can you just flip back and forth between versions if you are testing fixes (if they are necessary due to the newer version)?
Thanks again.
Cheers,
SunnyOzIt appears that I am using WP 4.9.8, and Foogallery plugin version 1.4.31.
I have gone into my files on the server, and just renamed the foogallery plugin as an experiment to see if I could allow myself to login. It worked, so now I can at least login to wp-admin, and access dashboard, etc. (Of course, none of my galleries are being displayed.. but I am hopeful they will once we solve the conflict problem).
I am hoping once we fix the coding error in the plugin, that I will just be able to rename the plugin, and all my previous albums and photo galleries will still be intact.
Here is the function that appears to be causing the error:
/** * Get back the extension endpoint based on a setting */ public function get_extensions_endpoint() { if ( 'on' === foogallery_get_setting( 'use_future_endpoint' ) ) { $extension_url = FOOGALLERY_EXTENSIONS_FUTURE_ENDPOINT; } else { $extension_url = FOOGALLERY_EXTENSIONS_ENDPOINT; } //make sure we always get the latest version! $extension_url .= '?v=' . wp_generate_password(); return apply_filters('foogallery_extension_api_endpoint', $extension_url ); }
Line 74 is where the fatal error is occuring.. which is this line in the above listed function:
$extension_url .= '?v=' . wp_generate_password();
Can you give me some guidance on how to fix the plugin? I am assuming that the newest version of your plugin isn’t compatible with the newest WP version?
Thanks.
An update:
I just went back to my localhost copy of the website where the carousel works properly. It looks like I haven’t updated the CPT Bootstrap Carousel plugin. Both localhost and online versions of the website have the same CPT Bootstrap Carousel plugin Version 1.9.1.
I also checked all the carousel settings and they are the same for both sites.
Keep in mind that the online site worked fine for a long time.. it is only just recently started this odd behaviour.. probably after I updated to the latest WordPress version.
If I view source on the localhost site, the code for a carousel image looks like this:
.<div class="item active" id="cptbc-item-106"> <img src="https://localhost/CIRB/CirbWP/wp-content/uploads/2015/07/DNA.jpg" class="attachment-full wp-post-image" alt="DNA" width="1200" height="600"> <div class="carousel-caption"> <h4>CIRB is committed to the ethical review of clinical research and the protection of human research participants</h4> </div> </div>
If I view the source for the online site, the code for a carousel image looks like this:
.<div class="item active" id="cptbc-item-106"> <img src="https://www.consortiumofirb.org/wp-content/uploads/2015/07/DNA.jpg" class="attachment-full size-full wp-post-image" alt="" srcset="https://www.consortiumofirb.org/wp-content/uploads/2015/07/DNA.jpg 1200w, https://www.consortiumofirb.org/wp-content/uploads/2015/07/DNA-260x130.jpg 260w, https://www.consortiumofirb.org/wp-content/uploads/2015/07/DNA-1024x512.jpg 1024w" sizes="(max-width: 1200px) 100vw, 1200px" width="1200" height="600"> <div class="carousel-caption"> <h4>CIRB is committed to the ethical review of clinical research and the protection of human research participants</h4> <p>Consortium of Independent Review Boards (CIRB) C IRB is a non-profit organization of independent institutional review boards committed to the ethical review of clinical research and the protection of human research participants. You are invited to explore our website to learn more about the history of CIRB and independent IRBs, to review CIRB's […]</p> </div> </div>
As you can see the <p> tag gets added. I checked.. the content it is picking up isn’t being taken from the home page’s snippet or excerpt.. it is actually being taken from the page content itself (I can tell because of the dropcap shortcut creates a space between the C and the IRB.)
Can you help me figure out what has changed, and how to stop it from displaying the extra content.
Forum: Fixing WordPress
In reply to: how to change home page permalink as referenced in submenu linksI got my answer from another forum. I thought I would post the answer here, in case others have the same problem.
I just had to change the slug, which you can do in quick edit for home page.
I hadn’t thought to look at quick edit. I had looked through the regular edit page, and couldn’t find the home-2 reference.. and I now realise that is because I didn’t have the slug field ticked to display on the normal edit page from my screen options.
I’ve changed my slug from home-2 back to home, and all is good now.
Just in case someone else has this problem.. You have to make sure that there isn’t another page with a slug of home in the Published, Draft, or Scheduled categories. (I had created a previous page named home that was a draft.. which is why my real home page got the slug of home-2 in the first place. But when I had trashed the old “draft” home page, and removed it permanently, it still hadn’t solved my problem.. until I changed my real home page’s slug back to home.)
Cheers,
SunnyOzForum: Themes and Templates
In reply to: [Shapely] shapely_home_parallax: Parallax Section for FrontPageNever mind… I just now found the answer for myself.
For those looking at this post in the future and want to do something similar, here is my solution:
The file to change is located here:
wp-content\plugins\shapely-companion\inc\widgets\class-shapely-home-parallax.phpI changed this line of code:
echo ('' != $button1 && '' != $button1_link) ? '<a class="btn btn-lg btn-filled" href="' . esc_url( $button1_link ) . '">' . wp_kses_post( $button1 ) . '</a>' : '';
to this:
if ( is_user_logged_in() ) { echo ('' != $button1 && '' != $button1_link) ? '<a class="btn btn-lg btn-filled" href="#">Welcome - You are already logged on</a>' : ''; } else { echo ('' != $button1 && '' != $button1_link) ? '<a class="btn btn-lg btn-filled" href="' . esc_url( $button1_link ) . '">' . wp_kses_post( $button1 ) . '</a>' : '';
Hope this helps.
SunnyOzForum: Plugins
In reply to: [Groups] Login redirect to a specific page depending on groupOh, dear.. excuse me!! I see that I am using the login form from TML.. so sorry for bothering you. I think I ended up using TML because I couldn’t get that part of Groups to work for me, and I was under a deadline. (I haven’t touched this site in 3 months, so I guess I forgot what I ended up doing.) I’ve got it to work now, that I realised I needed to edit the TML plugin correctly. I would like to figure out how to do this all through Groups one day, but I will table that for now. Thanks anyway.
Forum: Plugins
In reply to: [Groups] Login redirect to a specific page depending on groupSorry, @eggemplo, I am still confused. My Log-in page only has this on the page:
[theme-my-login]
Where do I put the the shortcode you are suggesting? Does it go under the [theme-my-login]?
Like this:
[theme-my-login]
[groups_login]
[groups_member group=”Committee Members”]
https://www.12thcaulfield.asn.au/committee-members/
[/groups_member]
[groups_member group=”Cub Scouts,Cub Leaders”]
https://www.12thcaulfield.asn.au/cub-members/
[/groups_member]
[/groups_login]“no images were found”
That’s the error I am getting when I click on a compact album gallery image.
Here is the code that is generated when I insert an album into a page:
<img class=”ngg_displayed_gallery mceItem” src=”https://localhost/xxxx/xxxx/nextgen-attach_to_post/preview/id–936″ alt=”” data-mce-placeholder=”1″ />This was created with using the green square “attach gallery to post” icon during a page edit – choosing these options: “Basic Compact Album”; “Display Source: Albums”; “Display Gallerys as: Thumbnails”; “Items per Page: 0”. (Zero Items per page gives you unlimited items on the page, right?)
I read somewhere that using a 0 items per page for albums may cause problems? Is this what nextgen plugin doesn’t like?
Forum: Plugins
In reply to: [Contact Form 7] To and From field not allowing nameThanks for the reply @davmerit, but unfortunately, what you have written doesn’t help with my particular problem.
I feel my actual problem is that there is a bug in the Contact Form 7 plugin, that won’t allow me to add a ‘sender name’ and/or ‘recipient name’ in 3 out of the 4 TO/FROM fields of MAIL 1 and 2.
What I want to use is this (but it won’t send out):
MAIL 1 FROM: [name] <[email]>
MAIL 1 TO: Company Name [email protected]
MAIL 2 FROM: Company Name [email protected]
MAIL 2 TO: [name] <[email]>What does work is this:
MAIL 1 FROM: [name] <[email]>
MAIL 1 TO: [email protected]
MAIL 2 FROM: [email protected]
MAIL 2 TO: <[email]>Since I am able to successfully use a ‘sender name’ on the MAIL 1 FROM field.. that makes me fell like it isn’t the hosting or the website that is causing the problem with the other TO/FROM fields.. but rather a bug in the plugin itself.
So I am awaiting a response from the plugin developer as to what could be causing this problem – or at least a work around, so I can include the sender/recipient names along with the email addresses.
~~~~~~~~~~~~
In response to your two specific points, I will address them below:
1. I thought that maybe the “WordPress” name was being placed there by WordPress itself, but wasn’t sure.. just thought I would check! The link you sent explains that WordPress is being placed there because I don’t have a ‘sender name‘ in the FROM field. Well.. that is EXACTLY WHAT I WANT TO DO.. BUT CAN’T.. hence the reason I posted asking for help to get this problem fixed. (If I place a ‘sender name’ in front of the MAIL 2 FROM eMail address, the MAIL 2 eMail will not send at all!)
2. I did consider that the problem might be that I have to ‘send’ from an eMail address from the domain name of the site of the website.. however that doesn’t track with the problems I am having..
The first eMail (MAIL 1) is sent FROM the address of the person that fills out the form, and is sent TO a domain eMail address. Even though the FROM field is NOT a domain address, this eMail sends fine! (So that proves my hosting package doesn’t “require that any emails being sent via WordPress are from a valid eMail address on your local domain”.) The issue I am having with the first eMail is that I can’t put a ‘recipient name’ in front of the eMail address I am using in the TO field – (which just happens to be a valid domain eMail address.) If I put the recipient name in the TO field (as in “Company Name <[email protected]>”), it will not send.
The odd note here is that I AM able to put in a ‘sender name’ in the FROM field (for Mail 1 only) – using the fields filled out in the form (as in “[name] <[email]>”.. but this only works on the First eMail – not on the Second eMail.. see below.
The second eMail (MAIL 2) is sent FROM a domain eMail address, and is sent TO the address of the person that fills out the form. This eMail also sends out fine. The issue I am having with the second eMail is that I can’t put a ‘sender name’ in front of the eMail address I am using in the FROM field (which is a valid domain eMail address – as in “Company Name <[email protected]>”), or a ‘recipient name’ in front of the eMail address I am using in the TO field – (using the fields filled out in the form as in “[name] <[email]>”. If I put the recipient/sender name in the TO/FROM fields it will not send. Because I can’t use the ‘sender name’ in the FROM field in the second eMail (MAIL 2) – this is why I am getting WordPress put in instead.
I would appreciate any help with figuring out a work around, so I can add the ‘sender name’ or ‘recipient name’ in addition to the eMail addresses, and get the eMails to actually send.
Thanks!
Forum: Plugins
In reply to: [Contact Form 7] To and From field not allowing nameHere is the rest of my post:
I would prefer to be able to include the CompanyName or Contact Name, but I can live with this until you get it fixed.
I am having the same problem with the FROM field in Mail 2. I can’t put the CompanyName into the field and get it to send out. (For some strange reason, I am able to use the FROM field properly in the Main mail setup – and have it send out properly.. as in using: “[name] <[email]>”
However, since I can’t use the Company name, in the FROM field in Mail 2, the word “WordPress” is placed there instead (next to my correct email address). It looks like this: “WordPress <[email protected]>”. Since this eMail is being sent to the person who filled out the form, this looks very unprofessional!!
Please fix the problem with using a ‘Name” in addition to an email address for the TO and FROM fields on both Mail 1 and Mail 2.
But in the meantime, can you please tell me where in the code you are placing the word “WordPress” as the default “name” to use, so I can change it to either a blank or something else, until you get a fix for the above.
Thanks,
SunnyOzForum: Plugins
In reply to: [Contact Form 7] Problems with from/to fields and sending 2nd mailOK.. I’ve nailed it down to be a problem with the To field. If you put in anything else than an eMail address in the To field of either the Mail 1 or Mail 2.. it won’t send out the eMail. I’ll open a nother post for this problem so it is not poluted with my comments while I was trying to figure out the problem!