Skip to content

Instantly share code, notes, and snippets.

@farik92
farik92 / acf_get_file.php
Created February 8, 2021 17:07 — forked from jdhobbsuk/acf_get_file.php
Get the file URL from ACF, including file type and size
/**
* Get ACF File
*
* @param string $key – the ACF field key
* @param string $post_id – the ID of the post (if empty, will use $post->ID)
* @return string The image URL
**/
function get_acf_file( $key = 'file', $post_id = '' ) {
if($post_id == ''):
global $post;
@farik92
farik92 / functions.php
Created January 25, 2022 01:15 — forked from naBJIyxa/functions.php
Произвольные Типы Записей Wordpress | Custom Post Type | Создание и Вывод
<?php
/**
* Добавляем произвольный тип записи со всеми настройками
* https://wp-kama.ru/function/register_post_type#hilsjs_extra_css
* Генератор Post Type https://generatewp.com/post-type/
* Ютуб https://www.youtube.com/watch?v=iRLhKNXNIzI
* Вывод https://wordpressrus.ru/wordpress/vyvod-proizvolnyh-tipov-zapisej-wordpress.html
*/
add_action('init', 'create_services_type');
@farik92
farik92 / cf7-sendpulse.php
Created February 15, 2022 21:54 — forked from smartdeal/cf7-sendpulse.php
пример интеграции #Wordpress #Sendpulse #WP_CF7
<?php
function add_email_to_sendpulse($contact_form) {
$wpcf7 = WPCF7_ContactForm::get_current();
$submission = WPCF7_Submission::get_instance();
$data = $submission->get_posted_data();
$cur_email = $data['Email'];
if ($cur_email != '') {
define( 'API_USER_ID', '' );
// Register Custom Taxonomy
function ess_custom_taxonomy_Item() {
$labels = array(
'name' => 'Brands',
'singular_name' => 'Brand',
'menu_name' => 'Brands',
'all_items' => 'All Brands',
'parent_item' => 'Parent Brand',
'parent_item_colon' => 'Parent Brand:',
@farik92
farik92 / Постраничная навигация с асинхронной подгрузкой постов
Created April 21, 2022 01:45
Постраничная навигация с асинхронной подгрузкой постов в WordPress. Бесконечная прокрутка постов.
https://truemisha.ru/blog/wordpress/ajax-pagination.html
Навигация
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<script>
var ajaxurl = '<?php echo site_url() ?>/wp-admin/admin-ajax.php';
var true_posts = '<?php echo serialize($wp_query->query_vars); ?>';
var current_page = <?php echo (get_query_var('paged')) ? get_query_var('paged') : 1; ?>;
var max_pages = '<?php echo $wp_query->max_num_pages; ?>';
</script>
@farik92
farik92 / acf-php-to-json.php
Created August 29, 2022 00:24 — forked from ollietreend/acf-php-to-json.php
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@farik92
farik92 / acf-field-group-php-to-json.php
Created August 29, 2022 00:27 — forked from mishterk/acf-field-group-php-to-json.php
Convert an ACF Field Group from PHP to ACF-JSON
<?php
// Get all the local field groups and loop through them for processing.
$field_groups = acf_get_local_field_groups();
foreach ( $field_groups as $group ) {
// If the field group has fields, load them into the 'fields' key.
if ( acf_have_local_fields( $group['key'] ) ) {
$group['fields'] = acf_get_local_fields( $group['key'] );
}
@farik92
farik92 / swiper-magnific-popup.js
Created October 31, 2022 21:21 — forked from thiagoeliasr/swiper-magnific-popup.js
Adding swipe support to Magnific Popup galleries. (touchSwipe is required: http://labs.rampinteractive.co.uk/touchSwipe/demos/)
(function() {
/* Define a variável que dá swipe no lightbox */
var magnificPopup = $.magnificPopup.instance;
/* Carrega a função quando clica no lightbox (senão não pega a classe utilizada) */
$("a.image-lightbox").click(function(e) {
/* Espera carregar o lightbox */
setTimeout(function() {
/* Swipe para a esquerda - Próximo */
@farik92
farik92 / swipe-magnific-popup.js
Created October 31, 2022 21:21 — forked from LovetsPaul/swipe-magnific-popup.js
swipe-magnific-popup
(function() {
/* Define a variável que dá swipe no lightbox */
var magnificPopup = $.magnificPopup.instance;
/* Carrega a função quando clica no lightbox (senão não pega a classe utilizada) */
$(".open-popup-link").click(function(e) {
/* Espera carregar o lightbox */
setTimeout(function() {
/* Swipe para a esquerda - Próximo */
@farik92
farik92 / Wordpress все для поста
Created November 1, 2022 01:04 — forked from Maxxidom/Wordpress все для поста
метки, Автор, Дата, Миниатюра, Рубрики, Заголовок, Цитата, Контент
//Метки
<?php the_tags('<ul class="myteginfo"><li>','</li><li>','</li></ul>'); ?>
//Автор
<?php the_author(); ?>
//дата
<?php the_time('d.m.Y г. H:i') ?> // Год 22.12.2015
<?php the_time('d.m.Y г. H:i') ?> // Год и время