fjguedes
Respostas criadas no fórum
-
Fórum: Problemas no funcionamento
Em resposta a: Atualizei e esta mostrando caminho das ImagensFórum: Problemas no funcionamento
Em resposta a: Atualizei e esta mostrando caminho das Imagens`<?php
/*
Plugin Name: Galeria de Fotos
Description: Plugin que apresenta as imagens destacadas (Featured Images) de páginas em formato de galeria. A galeria é inserida em páginas por meio do shortcode [galeria_imagens] e pode ser usado
Version: 0.3
*/// register the categories metaboxes for pages
function add_categories_to_pages() {
register_taxonomy_for_object_type( ‘category’, ‘page’ );
}
add_action( ‘init’, ‘add_categories_to_pages’ );// This function get all featured images from pages.
function get_images_from_featured( $atts ) {
// get the category from the shortcode
extract( shortcode_atts( array(
‘cat’ => ”
),
$atts ) );
// build the query to retrieve the pages
$args=array(
‘orderby’=> ‘rand’,
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
);
$query = null;
$query = new WP_Query($args);
$message = ”;
// build the gallery
if( $query->have_posts() ) {
$resposta = ‘<div id=”galeria”>’;
while($query->have_posts()) : $query->the_post();
// check if the shortcode give us a category to search. If not, show all pictures
if( $cat != ”) {
if( has_term( $cat, ‘category’, get_the_ID() ) ) {
if( has_post_thumbnail( get_the_ID() ) ) {
$resposta .= ‘<div class=”imagem”>’;
$resposta .= ‘<a href=”‘ . get_permalink( get_the_ID() ) . ‘” title=”‘ . esc_attr( get_the_title( get_the_ID() ) ) . ‘”>’;
$foto = get_the_post_thumbnail( get_the_ID() );
preg_match(‘/alt=”(.*)”/’,$foto,$matches);
$resposta .= $foto.'</a>’;
$resposta .= ‘<div class=”tarja”><span class=”nome”>’.esc_attr( get_the_title( get_the_ID() ) ).'</span><br/>’;
$resposta .= ‘<span class=”fone”>’.$matches[1].'</span></div></div>’;
}
}
}
else {
if( has_post_thumbnail( get_the_ID() ) ) {
$resposta .= ‘<div class=”imagem”>’;
$resposta .= ‘<a href=”‘ . get_permalink( get_the_ID() ) . ‘” title=”‘ . esc_attr( get_the_title( get_the_ID() ) ) . ‘”>’;
$foto = get_the_post_thumbnail( get_the_ID() );
preg_match(‘/alt=”(.*)”/’,$foto,$matches);
$resposta .= $foto.'</a>’;
$resposta .= ‘<div class=”tarja”><span class=”nome”>’.esc_attr( get_the_title( get_the_ID() ) ).'</span><br/>’;
$resposta .= ‘<span class=”fone”>’.$matches[1].'</span></div></div>’;
}
}
endwhile;
$resposta .= ‘</div>’;
}
wp_reset_query();
return $resposta;
}// Register the style sheet.
function register_plugin_styles() {
wp_register_style( ‘galeria_fotos’, plugins_url( ‘galeria-fotos/style.css’ ) );
wp_enqueue_style( ‘galeria_fotos’ );
}// Create the shortcode for use inside the pages.
add_shortcode( ‘galeria_fotos’, ‘get_images_from_featured’ );// Load the style sheet.
add_action( ‘wp_enqueue_scripts’, ‘register_plugin_styles’ );?>
- Esta resposta foi modificada há 8 anos por fjguedes.
Fórum: Problemas no funcionamento
Em resposta a: Atualizei e esta mostrando caminho das ImagensBoa dia amigo, obrigado por me responder. Estou usando um plguin feito apenas para isso.
ele é bem simples, puxa a foto em destaque e na pagina que eu colocar um shortcode , ele joga a imagem la com o link.
posso colocar aqui a programação dele.
Fórum: Problemas no funcionamento
Em resposta a: Atualizei e esta mostrando caminho das ImagensSim, vamos la.
Eu Tenho um pluguin que ao colocar qualquer foto em destaque eu uso um shorcode onde eu quiser e ele puxa a foto. Tudo funcionava normal, porem apos atualizar o wp, passou a aparecer o caminho das fotos na pagina. A pagina fica com a foto e varias letras do caminho aparecendo. Gostaria de esconder o caminho da foto.