Skip to content

Instantly share code, notes, and snippets.

@xtofr
Created January 5, 2017 07:11
Show Gist options
  • Save xtofr/5088b042c1882db10333a19f9d422926 to your computer and use it in GitHub Desktop.
Save xtofr/5088b042c1882db10333a19f9d422926 to your computer and use it in GitHub Desktop.
result is 504 Gateway time out
<?php
/* ****************************** Généralités Admin WP ****************************** */
/* Personnalisation du formulaire de cxion WP */
function my_login_stylesheet() {
wp_enqueue_style( 'custom-login', 'http://placedesqhse.net/wp-content/themes/maorigraphe/maori-login.css' );
//wp_enqueue_script( 'custom-login', get_template_directory_uri() . '/maori-login.js' );
}
add_action( 'login_enqueue_scripts', 'my_login_stylesheet' );
function my_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );
function my_login_logo_url_title() {
return 'Place des QHSE';
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );
/* changement expediteur Wordpress dans mails from WP */
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');
function new_mail_from($old) {
return 'wordpress@placedesqhse.net';
}
function new_mail_from_name($old) {
return 'administrateur Place Des QHSE';
}
/* ****************************** SearchWP ****************************** */
// suppress message inutile
add_filter( 'searchwp_missing_integration_notices', '__return_false' );
// highlight
function searchwp_term_highlight_auto_excerpt( $excerpt ) {
global $post;
if ( ! is_search() ) {
return $excerpt;
}
// prevent recursion
remove_filter( 'get_the_excerpt', 'searchwp_term_highlight_auto_excerpt' );
$global_excerpt = searchwp_term_highlight_get_the_excerpt_global( $post->ID, null, get_search_query() );
add_filter( 'get_the_excerpt', 'searchwp_term_highlight_auto_excerpt' );
return $global_excerpt;
}
add_filter( 'get_the_excerpt', 'searchwp_term_highlight_auto_excerpt' );
/* ****************************** déb SHORTCODES personnalisés ******************************
$user=wp_get_current_user(); */
add_shortcode( 'xtof' , 'ss_get_current_username' );
function ss_get_current_username(){
$user = wp_get_current_user();
$raison= xprofile_get_field_data( 'Raison sociale' , bp_get_member_user_id() );//fetch the text for Raison sociale
return $user->user_firstname . ' ' . $user->user_lastname . ' ';
}
/* ****************************** fin SHORTCODES personnalisés ******************************
/** * WordPress function for redirecting users on login based on user role
/* a trouver */
/*Masque la barre admin pour les utilisateurs non admin
function splen_remove_admin_bar() {
if( !is_super_admin() )
add_filter( 'show_admin_bar', '__return_false' );
}
add_action('wp', 'splen_remove_admin_bar');*/
/* ****************************** fin Généralités Admin WP ****************************** */
/* ****************************** déb BB PRESS ************************************ */
/* activer editeur de texte from https://codex.bbpress.org/enable-visual-editor/ */
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['teeny'] = false;
$args['quicktags'] = false;
return $args;
}
add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
/* filter to add description after forums titles on forum index https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/ */
function rw_singleforum_description() {
echo '<div class="bbp-forum-content">';
echo bbp_forum_content();
echo '</div>';
}
add_action( 'bbp_template_before_single_forum' , 'rw_singleforum_description');
/* display bbPress search form above single topics and forums */
function rk_bbp_search_form(){
if ( bbp_allow_search()) {
?>
<div class="bbp-search-form">
<?php bbp_get_template_part( 'form', 'search' ); ?>
</div>
<?php
}
}
add_action( 'bbp_template_before_single_forum', 'rk_bbp_search_form' );
add_action( 'bbp_template_before_single_topic', 'rk_bbp_search_form' );
/* Icones pour les statuts des posts
Show status labels for bbPress Topics <img src="http://placedesqhse.net/wp-content/themes/jupiter/assets/icons/icomoon/svg/69.svg" alt="sticky" width="16px">
// mk-moon-stack-empty /mk-moon-stack-plus/ mk-icon-exclamation / mk-li-apeaker
*/
function rk_sticky_topics() {
if ( bbp_is_topic_sticky() && !bbp_is_topic_closed() )
echo '<span class="sticky"><img src="http://placedesqhse.net/wp-content/themes/jupiter/assets/icons/icomoon/svg/69.svg" alt="sticky" width="16px"></span>';
}
add_action( 'bbp_theme_before_topic_title', 'rk_sticky_topics' );
function rk_announcement_topics() {
if ( bbp_is_topic_sticky() && bbp_is_topic_closed() )
echo '<span class="announcement"><img src="http://placedesqhse.net/wp-content/themes/jupiter/assets/icons/pe-line-icons/svg/e662.svg" alt="announcement" width="16px"></span>';
}
add_action( 'bbp_theme_before_topic_title', 'rk_announcement_topics' );
function rk_new_topics() {
$offset = 60*60*12;
if ( get_post_time() > date('U') - $offset )
echo '<span class="new"><img src="http://placedesqhse.net/wp-content/themes/jupiter/assets/icons/icomoon/svg/e23b.svg" alt="new" width="16px"></span>';
}
add_action( 'bbp_theme_before_topic_title', 'rk_new_topics' );
/* ****************************** fin BB PRESS ************************************ */
/* **************************** Début Hooks Woocommerce *******************************/
/* https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ */
/* ***************************** Fin Hooks Woocommerce *******************************/
?>
<?php
/*
** search.php
** mk_build_main_wrapper : builds the main divisions that contains the content. Located in framework/helpers/global.php
** mk_get_view gets the parts of the pages, modules and components. Function located in framework/helpers/global.php
*/
get_header();
mk_build_main_wrapper( mk_get_view('templates', 'wp-search', true) );
get_footer();
### Begin System Info ###
## Please include this information when posting support requests ##
Multisite: No
SITE_URL: http://pqhse.crescendo-formation.fr
HOME_URL: http://pqhse.crescendo-formation.fr
SearchWP Version: 2.8.6
WordPress Version: 4.7
Permalink Structure: /%postname%/
Active Theme: Maorigraphe 5.4.1
Registered Post Stati: publish, future, draft, pending, private, trash, auto-draft, inherit, closed, spam, orphan, hidden, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed
PHP Version: 5.6.21
MySQL Version: 5.6.34
Web Server Info: Apache
WordPress Memory Limit: 96M
PHP Safe Mode: No
PHP Memory Limit: 512M
PHP Time Limit: 300
WP_DEBUG: Disabled
WP Table Prefix: Length: 7 Status: Acceptable
WP Remote Post: wp_remote_post() works
TEMPLATES:
search.php No
POTENTIAL TEMPLATE CONFLICTS:
NONE
POTENTIAL FILTER CONFLICTS
pre_get_posts => WPSEO_Sitemaps::redirect
pre_get_posts => bbp_pre_get_posts_normalize_forum_visibility
pre_get_posts => wpse57351_pre_get_posts
pre_get_posts => wc_shop_order_status_backwards_compatibility
pre_get_posts => SearchWP::impose_engine_config
the_posts => WooCommerce_Membership_Post::filter_posts
ACTIVE PLUGINS:
Artbees Themes Captcha: 1.0
bbPress: 2.5.12
bbPress shortcodes for Visual Composer: 1.0
BuddyPress: 2.7.4
Coming Soon Page & Maintenance Mode by SeedProd: 5.0.5
Contact Form 7: 4.6
Duplicate Post: 3.1.2
EventON: 2.4.10
LayerSlider WP: 5.6.5
Loco Translate: 2.0.11
MainWP Child: 3.2.5
Nested Pages: 1.6.5.2
Pretty file list pro: 1.9.3
SearchWP: 2.8.6
SearchWP bbPress Integration: 1.2.4
SearchWP Boolean Query: 1.3
SearchWP Exclude UI: 1.0.1
SearchWP Fuzzy Matches: 1.4.3
SearchWP LIKE Terms: 2.4.4.1
SearchWP Shortcodes: 1.5.3
SearchWP Term Highlight: 2.0.13
SearchWP Term Synonyms: 2.4.7
Slim Stat Analytics: 4.5
TablePress: 1.7
User Role Editor: 4.31
WooCommerce: 2.6.11
WooCommerce Membership: 2.2
Wordfence Security: 6.2.9
WP-DBManager: 2.78.1
WPBakery Visual Composer (Artbees Modified Version): 4.12.2
WP Sitemap Page: 1.6
Yoast SEO: 4.0.2
STATS:
Array
(
[last_activity] => 6 heures ago
[total] => 477
[remaining] => 0
[done] => 477
[in_process] =>
)
Main table row count: 59696
Running: No
Processing Purge Queue: No
Paused: No
SETTINGS:
Array
(
[default] => Array
(
[post] => Array
(
[enabled] => 1
[weights] => Array
(
[title] => 5
[content] => 15
[slug] => 5
[tax] => Array
(
[category] => 2
[post_tag] => 2
)
[excerpt] => 6
[comment] => 1
)
[options] => Array
(
[exclude] =>
[attribute_to] => 0
)
)
[page] => Array
(
[enabled] => 1
[weights] => Array
(
[title] => 20
[content] => 10
[slug] => 10
[comment] => 1
)
[options] => Array
(
[exclude] =>
[attribute_to] => 0
)
)
[employees] => Array
(
[enabled] => 1
[weights] => Array
(
[title] => 20
[content] => 2
[slug] => 10
[tax] => Array
(
[employees_category] => 5
)
)
[options] => Array
(
[exclude] =>
[attribute_to] => 0
)
)
[forum] => Array
(
[enabled] => 1
[weights] => Array
(
[title] => 5
[content] => 15
[slug] => 5
)
[options] => Array
(
[exclude] =>
)
)
[topic] => Array
(
[enabled] => 1
[weights] => Array
(
[title] => 5
[content] => 15
[slug] => 5
[tax] => Array
(
[topic-tag] => 5
)
)
[options] => Array
(
[exclude] =>
)
)
[attachment] => Array
(
[enabled] => 1
[weights] => Array
(
[title] => 5
[content] => 15
[slug] => 5
[tax] => Array
(
[media_categories] => 5
)
[excerpt] => 6
[cf] => Array
(
[swpp586d8e4933eed336856772] => Array
(
[metakey] => searchwp_content
[weight] => 2
)
[swpp586d8e4933f77593663444] => Array
(
[metakey] => searchwp_pdf_metadata
[weight] => 2
)
)
)
[options] => Array
(
[exclude] =>
[mimes] => 1
)
)
[reply] => Array
(
[enabled] =>
[weights] => Array
(
[title] => 5
[content] => 15
[slug] => 10
)
[options] => Array
(
[exclude] =>
)
)
[product] => Array
(
[enabled] =>
[weights] => Array
(
[title] => 20
[content] => 2
[slug] => 10
[tax] => Array
(
[product_type] => 5
[product_cat] => 5
[product_tag] => 5
[product_shipping_class] => 5
)
[excerpt] => 6
[comment] => 1
)
[options] => Array
(
[exclude] =>
[attribute_to] => 0
)
)
)
)
PURGE QUEUE:
[Empty]
### End System Info ###
<section class="mk-search-loop">
<section class="widget widget_search"><p><?php esc_html_e( 'Not so happy with results? Search for a new keyword ', 'mk_framework' ); ?></p>
<form class="mk-searchform" method="get" id="searchform" action="<?php echo home_url('/'); ?>">
<input type="text" class="text-input" placeholder="<?php esc_attr_e( 'Search site', 'mk_framework' ); ?>" value="" name="s" id="s" />
<i class="mk-searchform-icon"><?php Mk_SVG_Icons::get_svg_icon_by_class_name(true,'mk-icon-search',16); ?><input value="" class="search-button" type="submit" /></i>
</form>
</section>
<?php
if ( have_posts() ):
while ( have_posts() ) :
the_post();
$post_type = get_post_type();
?>
<article class="search-result-item">
<h4 class="the-title"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h4>
<div class="search-loop-meta">
<span><?php esc_html_e( 'By', 'mk_framework' ); ?> <?php the_author_posts_link(); ?></span>
<time datetime="<?php the_time('Y-m-d'); ?>">
<?php the_date('', '<time datetime="'.get_the_time().'">' . esc_html__( 'On', 'mk_framework' ) . ' <a href="'.get_month_link( get_the_time( "Y" ), get_the_time( "m" ) ).'">', '</a></time>'); ?>
</a>
</time>
<?php
echo '<span class="mk-search-cats">';
switch ($post_type) {
case 'post':
echo esc_html__( 'In', 'mk_framework' ) . ' '.get_the_category_list( ', ' );
break;
case 'portfolio':
echo esc_html__( 'In', 'mk_framework' ) . ' '.implode(', ', mk_get_custom_tax(get_the_id(), 'portfolio', true));
break;
case 'news':
echo esc_html__( 'In', 'mk_framework' ) . ' '.implode(', ', mk_get_custom_tax(get_the_id(), 'news', true));
break;
}
echo '</span>';
?>
</div>
<div class="the-excerpt"><p><?php mk_excerpt_max_charlength(200) ?></p></div>
</article>
<?php
$post_type = '';
endwhile;
mk_post_pagination(NULL);
wp_reset_query();
endif;
?>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment