Forum Replies Created
August 24, 2019 at 7:08 am in reply to: Advice for making blog with many posts easier to navigate #1130553
I have cleared cache in WP Super cache and in Safari on my cellphone, but the problem is still there. I see that the menu displays differently on the other pages (except the frontpage where the extra search field is added). For the other pages, it is added “undefined”. See screenshots:
I could not find that custom code in the functions.php or the header.php, which was the places I supposed it could be in the child theme. I see that this extra search field does not show up on computer, even if I make the browser width small. Could it possibly be caused by a plugin?
Thanks for the quick reply! Nikko said in the first reply in this tread that “header-q_a.php will not be called”. It is in “header-q_a.php” that the code you mentioned in your last reply is included. The previous developer had also added a “taxonomy-q_a.php”, which is almost identical to the “taxonomy-portfolio_entries.php” which is included with the theme. I also have “taxonomy-q_a.php” in my child theme folder. In this file, header.php is called. In single-q_a.php, I have included get_header(‘q_a’); I just wanted to confirm that the code you mentioned in your last reply actually in run.
Thanks, now the posts are hidden within our website. Is there any way I can thank you? I was thinking about emailing Kriesi and thank for the good support, your help has been above my expectations:)
When I discovered that the posts with the custom field “status” set to “private” had become visible, I changed the Visibility from “Public” to “Private” for all these posts, so that they are not visible for anyone. I tested the solution by changing the Visibility for (Purchase code hidden if logged out) -desember/”>one of the former q_a posts to “Public” again. The post is still found by Google and the content is catched, so it can be read through Google, even if I change the Visibility to “Code” and use the code again. Can we set that the q_a posts with the custom field “status” set to “private” shall be hidden (“nofollow” “noindex”) so we prevent them from being displayed by most search engines?
If it is difficult to hide the previously published q_a posts with the custom field “status” set to “private”, we can delete them. But we need the new q_a posts with the custom field “status” set to “private” to be hidden. I also tried to create a new q_a post with the custom field “status” set to private. I also chose “Visibility: Password protected”. Then the post content can only be viewed by those who have the code. It is not found by Google, maybe because it takes some time for Google to discover it?
Thank you so much, Ismael. You are really patient! I don’t know how I should have solved this without your help. I added the updated code according to your instructions, cleared cache and tested, but the problem I described in my reply on July 5 remains. I still get the search results for “Test” (see screenshot ) when I am searching in the test post title. The same happens when I am searching in the test post content (see screenshot) for my search for “question”.
The “status” and the three other custom fields are present only for the custom post type name/slug “q_a” (see screenshot of setting in the plugin Custom Fields). We also have a custom post type name/slug “ordliste”, but this should always be visible to all, so it does not contain any custom fields. Then we have the ordinary WordPress posts.
Hello Ismael! Great that the post now is visible from the front page once the code is typed into the search field. I think we are almost done now.
In the reply to you on June 13th I mentioned that we use Advanced Custom Fields (ACF) and that “One ACF is “status” that can be set to either “public” or “private”.” But that is a long time ago now, so I understood that you did not remember:)
The only thing I am missing now is that the title and content from the Q&A posts with the ACF field status set to “private” should not be searchable. In the test post I made, the title is “Test title” and the content is “Test question from user”. If I search for “Test” or “question” on the front page (write it in the search field without clicking on the search icon or pressing enter), the post is still found (see screenshot). It should be hidden, so that it is only visible by searching for the code. However, it is hidden when I press the search button. https://www.guttogjente.no/?s=question and https://www.guttogjente.no/?s=test does not display this private post in the search results. In the plugin “Custom search” I tried to set “code” as the only searchable field for custom posts, but it did not help (it would also not be an ideal solution, since the public posts would not be searchable either then). Another thing that separate the private posts from the public ones is that they don’t have a featured image, if that could help to hide them in the search query.
I have added a PHP-file in the private content (zipped it to upload it in WordPress) which contains what I added to functions PHP with a clearer commenting of what the developer added, so it is easier for you to read the code. I meant to say that “Ordliste” is another custom post TYPE, (not category). I tried to change it to “any” and I also tried to replace that line with the default Enfold-code, but my site shows “Techical problem” if I try a search when the code from the attached PHP-file is added to my functions.php (you my try and log in and add the code to functions.php and see).
Can it have to do with what Nikko pointed out in the first reply in this thread, where he wrote “header-q_a.php will not be called”?
Hello Ismael! I activated ” Search Everything ” after the comment from Basilis, but now I deactivated it again since I realized that the custom search does not work when it is activated. Now you can access https://www.guttogjente.no/?s=359017
I updated my reply from June 13, 2019 at 4:53 am, where I meant to write that the former developer had changed the code to:
$defaults = array('numberposts' => 5, 'post_type' => array('post','Ordliste'), 'post_password' => '', );
I refer to that post again to see how I modified the code based on comparing with the latest Enfold code.
‘Ordliste’ is another custom post category, so it seems like it first handles the normal cases where no password is needed and all posts shall be displayed? It is only for q_a that some posts are private so code is needed. For all other post types (standard posts and ‘Ordliste’ they are always visible.
I had deactivated ”Search Everything”, since the “Custom Search by BestWebSoft” plugin already allows search in Custom Fields. But enabled ”Search Everything” also now, in case it can help to solve this problem.
I definitely agree that the best solution would have been to get i touch with the previous developer. As I mentioned earlier in this tread, I also tried to contact the company who made the webpage, but the company had changed and they could no longer help me. Our webpage is mostly run by me and another volunteers to answer questions from youths, which they ask anonymously. They do not leave any contact information in the Gravity Form, but get a 6-digit code in the confirmation message that is generated automatically (this coding I managed to add successfully). On submission, a draft of a custom post type with their question and the code is automatically generated. The custom post type is made with the plugins CPT UI and contains Advanced Custom Fields (ACF) .One ACF is “status” that can be set to either “public” or “private”. Later, they can check their answer by searching for that code. If the answer is not suitable for being public, because it contains private information that can be tracked back to the person, it is made private so only the person with the code can view it. Therefore, we can not use the built in “private” function in WordPress.”
If you have other solutions to achieve the same functionality I appreciate your suggestions.
Except for in one sentence, I did not modify the code, I just pasted the old modifications to the code in between the existing code where it had been before.
One change that I suspect could make the code above break down is that Enfold 2.4.1 had:
$defaults = array('numberposts' => 5, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false);
which the former developer modified to:
$defaults = array('numberposts' => 5, 'post_type' => array('post','Ordliste'), 'post_password' => '', );
The latest Enfold had:
$defaults = array('numberposts' => 5, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false, 'results_hide_fields' => '');
So I tried to combine the latest version and the modification to:
$defaults = array('numberposts' => 5, 'post_type' => array('post','Ordliste'), 'post_password' => '', 'suppress_filters' => false, 'results_hide_fields' => '');
Also, I noticed that this is an “if”-sentence without any “else”-argument.
The problem now is that I have three versions of the content in if(!function_exists(‘avia_ajax_search’)) in functions-enfold.php, which makes it difficult to compare them and know what to keep and what to delete:
1) The orginial from version 2.4.1
2) The modified version 2.4.1 with custom code added by the person why made my webpage
3) The newest version of functions-enfold.php from the current Enfold theme
I see there have been some modifications in of the content in if(!function_exists(‘avia_ajax_search’)) from version 2.4.1 to the latest Enfold version. Do you think it might work to simply replace the content in if(!function_exists(‘avia_ajax_search’)) in functions-enfold.php in my child theme with the version that the person who made my webpage some years ago created? Or do I need to compare it with the changes in the newest version of Enfold as well?
If I only want to modify the content in if(!function_exists(‘avia_ajax_search’)) in functions-enfold.php, do I only include that part in my child theme functions-enfold.php or should I include all the contact from the functions-enfold.php in my child theme as well? For functions.php I see that I only include my own functions in the child theme, so this file does not replace functions.php in the original theme files but just add on to it?
- This reply was modified 2 months, 2 weeks ago by guttogjente.
Thanks! It had to do with the plugin Custom Sidebars, so I made a new sidebar in another widget and chose that one as the sidebar for this page to get the correct formating. This case can be closed.May 21, 2019 at 9:34 am in reply to: Issue with Enfold and the plugin "Custom Sidebars" #1102752
Thanks for the reply. I could not understand why I should make a function to disable the sidebar. I want to display the sidebar, but there is a problem with choosing sidebar for the Archive pages in the plugin. But you can close this case, it is not so important.May 16, 2019 at 2:36 am in reply to: Issue with Enfold and the plugin "Custom Sidebars" #1101204May 15, 2019 at 3:38 am in reply to: Issue with Enfold and the plugin "Custom Sidebars" #1100785
Yes, they answered at their support: “Did they maybe suggest what modification needs to be done on our side? I can see the issue with Enfold theme enabled. I will report this to the developer of Custom Sidebars, however, it might be not possible to fix this on our side.” You can see the full dialogue at their support here: (Purchase code hidden if logged out) /#post-11522040″>
This is how it should look (it looks like this by default, I have not applied any custom styling):
This is how it looks currently:
April 29, 2019 at 3:19 pm in reply to: Remove date from blog grid layout and search results #1095310
Thanks, that worked when I put the css in the child theme css file (put not when I put it in the quick css, although I cleared cache). This case can be closed.
Thank you for the great job you do at the support, much appreciated! This case can be closedApril 27, 2019 at 2:05 am in reply to: How to add search bar to existing column in Layout Builder #1094855
Excellent instruction, it worked well! Thank you for the great job you do at the support, much appreciated! This case can be closedApril 27, 2019 at 2:04 am in reply to: Color of search box and menu underline changed when I switched to child theme #1094854
Thank you for the great job you do at the support, much appreciated! This case can be closedApril 27, 2019 at 2:03 am in reply to: Layer Slider WP navigation buttons will not change #1094853
Thank you for the great job you do at the support, much appreciated! This case can be closedApril 27, 2019 at 2:02 am in reply to: Display different widget in sidebar for custom post type #1094852