L
L
ligisayan2017-09-22 18:10:12
PHP
ligisayan, 2017-09-22 18:10:12

Why are the functions (wordpress) not executed and it is not possible to overwrite files on the hosting?

Hello! For security reasons, the admin has denied FTP access, so I connect using WinSCP .
I need to change
1. Exclude category output according to the FAQ , I change it consistently in the files home.php, index.php, single-post.php

if (have_posts()) : while (have_posts()) : the_post();

on the
query_posts($query_string .'&cat=-1'); if ( have_posts() ) :  while ( have_posts() ) : the_post();

but, it does not give a result, and any change to these files is not displayed even in the console editor in the admin panel, although the files are changed on the hosting when they are uploaded - why? however, although you can change the entries only through the editor - this does not give a result on the site, the rubric is still displayed.
2. in the function.php function file, again, only through the console editor can I add the following functionality, but this does not lead to a result .. why?
//атрибут nofollow для ссылок выбранной рубрики
function wph_nofollow_in_category($content) {
global $post;
    if(in_category(5054)) { //указываем ID рубрики
        $content = stripslashes(wp_rel_nofollow($content));
    }
    return $content;
}
add_filter('the_content', 'wph_nofollow_in_category');

there is a suspicion that this is the result of the output of the function above in the same file
/***********************************/
 //изменяем основной запрос категории и блога
add_filter('pre_get_posts','attila_category_and_home');
function attila_category_and_home( $query ) {
    if ( ($query->is_home|| $query->is_category)&&$query->is_main_query()) {
    
    
  //$query->set( 'posts_per_page', 2 );		
    $query->set( 'ignore_sticky_posts', 1 );
  
if (!empty($_GET['rn'])) {					
          $meta_query = array(
            array(
              'key' => 'rayon',
              'value' => $_GET['rn']
            )
          );
          //$query->set( 'cat', '1' );
          //$query->set( 'post_type', 'post' );
          $query->set( 'meta_query', $meta_query );
          
          
          //print_r($query);

          }					




if (!empty($_GET['days'])) {		
          
          $day_from_picker=explode("-", $_GET['days']);
          //print_r($day_from_picker);
          $date_query = array(
            array(
              'year'  => $day_from_picker[0],
              'month' => $day_from_picker[1],
              'day'   => $day_from_picker[2],
            )
          );
          
          $query->set( 'date_query',  $date_query = array(
            array(
              'year'  => $day_from_picker[0],
              'month' => $day_from_picker[1],
              'day'   => $day_from_picker[2],
            )
          ));					
          
          }	
        
    }	
    return $query;
}

3. an entry in the .htaccess file , but I don’t see it through WinSCP , but when I try to update the file, it says - replace? How can I change this file in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2017-09-22
@lazalu68

1. If you are sure that this WinSCP of yours really changes the file, and does not pretend to be a hose (this happened before with filezilla), then try google the phrase "wordpress i make changes nothing happens" . This is already like a fable, one gets the impression that everyone rushes to the first file that comes across and torment him, torment him. There is a 146% chance that you are editing the wrong file. Everything is as usual here - if you don’t want to read the WordPress code and understand how everything works , then debug by all possible means, in this case you can echo in the same functions.php . Text not showing up? So, miss, look for another script that should be executed according to the hierarchy,
2. The same thing - either read the code or debit,
3. First, you didn't say which protocol WinSCP works through; secondly, in the phrase "I don't see it through WinSCP, but when I try to update the file it says - replace" I don't see any contradictions, it's quite possible that some strange set of settings prohibits WinSCP from listing this file, but does not prohibit changing it. By the way, can the file really be modified using WinSCP?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question