Questions tagged [code]
The code tag has no usage guidance.
305
questions
1
vote
1
answer
951
views
Gist shortcode is not working
I freshly installed a brand new Wordpress for testing purpose as I am intending to refresh my current website. One of the requirement I have is to be able to embed code from Gist. Following the ...
2
votes
1
answer
2k
views
Adminbar Missing "Edit Page"
I'm encountering a problem that involves that my Admin bar doesn't show the "Edit Page" on pages I visit on my site. Instead for some odd reason it show "Edit Category" instead on supposed page.
Does ...
2
votes
1
answer
5k
views
Successful or Error Message after running mysql code in functions.php
Just for this article, suppose there is a code that I want to run on my WordPress' functions.php file. It's a code to delete mysql table on my database. For example, here's the code:
$wpdb->query( ...
0
votes
1
answer
191
views
get post excerpt by query
I'm trying to get post excerpt by query my code is below
global $wpdb;
$posts = $wpdb->get_results ("SELECT post_title, post_excerpt
FROM $wpdb->posts WHERE post_status = 'publish' AND (...
0
votes
1
answer
22
views
How to stop displaying the Id without losing the functionality
I am using a custom code to make certain plugin's functionality available only with particular capabilities.
Here is the code:
<?php
// Check if User can Edit
// Set permission to false = 'not ...
0
votes
1
answer
13k
views
how to call new widgets in sidebar in custom theme?
I am developing a theme in which I want to call available widgets ex. Calendar and the installed plugin, I have put it in the sidebar from widget panel but can't see in frontend.
Sidebar.php Code->
&...
0
votes
1
answer
65
views
Blog only showing code
I would like to have some help.
I host a wordpress blog in my raspberry pi running apache2, but when I browse the blog it only shows the code as you can see here http://lifeonpi.sytes.net/raspgrammer/
...
1
vote
1
answer
179
views
Latest post in a specific menu
is it possible to show the latest posts only in a specific menu?
This is my menu:
register_nav_menus(array(
'primary' => __('Primary Navigation', 'gonzo'),
'mobile' => __('Mobile Navigation', ...
0
votes
1
answer
75
views
Display pages from specific page template
Okay I have found the following code on line, which seems to be working and displaying all of the pages using the page_library_html.php template. This code only shows the title of them though. Can ...
-1
votes
1
answer
113
views
Simple Redirect but getting the right code?
I need to change these links so the dashboard link directs to the forum profile instead of the wordpress admin panel profile can you help?
<ul>
<li><a href="<?php ...
-1
votes
2
answers
255
views
Code Highlighting in BlockQuote
Many of my Wordpress Blog(http://subinsb.com/) posts have code snippets which is wrapped in blockquote elements. I need to highlight these code snippets. I tried using GeSHi, Prettify Code Syntax, ...
1
vote
1
answer
3k
views
How to add source code into wordpress post really?
Ok, I have read and followed the instructions as written in this link:
http://en.support.wordpress.com/code/posting-source-code/
I have tried all other the solutions, including reinstall the whole ...
0
votes
1
answer
2k
views
How to get tags and categories?
I used the following code to get tags from the post and then simply echo them:
$posttags = get_the_tags($post->ID);
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ', ';}
...
0
votes
0
answers
138
views
Live coding in WordPress
Is there a plugin or an easy way to integrate code writing and compilation windows in WordPress, for example to duplicate the Learn Python functionality (see at bottom).
1
vote
2
answers
2k
views
How to display php source code inside a post using visual editor?
NOTE
I don't want the php code to be executed, only displayed.
I want to display this php code <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?> inside a post. I cannot make ...
5
votes
2
answers
2k
views
Create custom [sourcecode] shortcode, the right way?
What I want to do
Sharing code in posts on WordPress is quite a pain with all the HTML escaping to take care of. So, I plan to enclose code in posts within a custom shortcode called [sourcecode], as ...
18
votes
1
answer
85k
views
What is the meaning of %s, %1$s etc.? [closed]
From a Q&A Thread I've came to meet with some old things, but I'm afraid, I found myself in a condition that, I still don't know the meaning of them and don't know why to use them.
%1$s - (found ...
1
vote
0
answers
28
views
Need To Post Unformated Code
Im wanting to use wordpress to share some code snips. However when viewing the posts some of the code tries to format even though its in pre or code tags. Is there anyone way to modify
<?php ...
0
votes
2
answers
392
views
Wordpress code editor messed up my code!
I just spend a few hours trying to make my code look better. In the past, I did some changes using Wordpress code editor and after downloading these files yesterday, I noticed that code is totally ...
0
votes
0
answers
107
views
Code auto escaping is not working when using short codes
I'm using this ages old, but still well working, plugin (source code here) to auto escape html inside <code>.
All is well and good until I tried to use short codes to form the <pre><...
0
votes
2
answers
883
views
How to link to a alternative page in CSS
I have a wordpress site and I want to be able to completely change a page that is displayed based on the browser size in my Custom CSS, so that if it is over 1500 pixels it loads a completely ...
0
votes
1
answer
305
views
Loop don't work within single.php page
I have this code below within the loop
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="new-posts-form">
<div class="new-posts-img">&...
0
votes
1
answer
5k
views
How do I reset my footer.php to its original state? (theme: Origami)
I accidentally deleted some codes from my footer.php trying to get rid of the 'Theme By Origami' footer, and now the footer is all messed up. How do i reset it to its original state?
I feel so stupid, ...
1
vote
0
answers
66
views
Wordpress editor removes all the linefeed characters with WP-Markdown and Syntax Highlighter evolved
I have WP-Markdown and SyntaxHighlighter Evolved wordpress plugins installed.
The issue is that when I write the code, and click the "Update" button, I have the code reformatted.
[ruby]
class Foo &...
2
votes
1
answer
3k
views
How do i get (unique) page name?
Like from the page of http://localhost/wordpress/about_us/ how do i get only the "about_us" ?
Thanks
0
votes
1
answer
506
views
Wordpress editor, change code wrap (bbpress?)
I am developing a theme and using jquery prettify to style code tags. Sofar I love prettify, and for the most part wordpress is cooperating.
When text is wrapped in <code> tags everything ...
0
votes
0
answers
1k
views
How to add a class name to the ancestor <li> of a post?
I've asked this question before with a different Question Title over at Stackoverflow.
At that time, I was not yet aware that a function of the theme is adding a class name called current-menu-item. ...
0
votes
2
answers
145
views
random reason on refresh
I am editing the sidebar widgets and have added one for users who are not logged in or registered. the widget requests that users register or login and I am wanting to add a random reason (quote) as ...
0
votes
1
answer
53
views
why is markup routinely placed in functions in wordpress?
Here is an exampple from a woothemes theme. I'm definetly not having a go at woothemes - they are a great theme provider with great standards and this sort of thing is fairly typical in themes. why?
...
-1
votes
2
answers
4k
views
Creating a press page for our project
Over time our project got some good press: press releases, interviews, media appearances
Now I want to create a "press page" (something like this). Requirements:
is easy to update - everyone can ...
0
votes
1
answer
254
views
CSS Styling for a Page/ Site made with Pagelines
I know how to change the HTML of page inside wordpress but for some reason I can't find the CSS for the page I'm looking for. I can find a huge amount of code made by Pagelines(Is it in there?). The ...
3
votes
2
answers
899
views
Including Angle Brackets In Pre Sections
I am attempting to post some java code between pre tags but the angel brackets get removed. For example:
private HashMap<String, HashMap<String, Integer>> featureCounts;
becomes
...
0
votes
1
answer
3k
views
Log in / Log Out Custom Button
On our website we have a "Join" button in the top right corner and a log in / log out link using <?php wp_loginout(); ?> . Instead of having the log in / log out link we would like to have it ...
0
votes
1
answer
417
views
Anchor Text code string is automatically modified by WordPress
I have created an ad for a merchant wanting to rent ad space on my website home page. After creating the ad, (anchor text and pic/graphics with embedded hyperlink) the merchant has requested I remove ...
1
vote
2
answers
111
views
WP-Markdown treating java generics like HTML tags
With some Java generic code in a code block, ie:
List<Integer> l = new ArrayList<Integer>();
WP-Markdown was treating as HTML, and no matter what I did, the code above got turned into ...
1
vote
2
answers
164
views
Hiding styles from Facebook
Some of my pages/posts have very short custom stylesheets at the beginning of them. I know this isn't great practice, but it's worked very well thus far. The problem, however, is linking on Facebook: ...
1
vote
1
answer
1k
views
Remove line breaks from <code>?
This code form HTML editor:
<code>[shortcode]
[bar]foo[/bar]
[bar]foo[/bar]
[bar]foo&...
2
votes
1
answer
548
views
Sublime Video: Playlist which gets all attached videos
I searched a way to automatically load all attached videos in a custom post type as SublimeVideo playlist. After some time I got it working and here I'll share the code with everyone who is interested ...
8
votes
2
answers
469
views
WordPress Internal @ Mentions
I'm looking for a way to link to author pages within one WordPress install simply by putting the @ symbol in front of a person's username in a post.... just like on twitter.
Example:
If the username ...
1
vote
1
answer
131
views
How does WordPress determine which multisite the user is on from the URL?
What is the file and line where WordPress determines which multi-site the user is on from the URL?
I've been looking through the code all afternoon and can't figure out where it turns mysite.com/...
0
votes
2
answers
122
views
Filter and Search
I am working on my site which is a WordPress based site. It is a sweepstakes site well winprizesonline.com is the site which inspired me most. Now I want a dynamic search like that site on my site but ...
1
vote
1
answer
998
views
stats_get_csv (Wordpress Stats) to only display top posts (not pages)
I'm trying to get the first 10 posts based on page views through Wordpress Stats (now called Jetpack).
I managed to get this code to work (approximately..) after digging for hours over the forums (...
-2
votes
1
answer
105
views
Code snippet plugin not working correctly with Windows live writer and Wordpress
Downloaded the The Live Writer Source Code Plug-in For WordPress.com Blogs. The preview looks good but the published version looks really messed up. Could anybody let me know what could be the fix.
...
3
votes
1
answer
3k
views
API integration with WordPress
I'm trying to integrate a 3rd party API with WordPress. I fear this is above my head. I was this code but I'm not exactly sure how to make is work in WordPress. Is it possible?
$ch = curl_init();
...
0
votes
1
answer
272
views
Commenting out in HTML editor breaks template
There is a certain section of HTML that I need to comment out within the HTML editor in Wordpress. But when I do so, it breaks the HTML. After looking at the source code, I noticed that it converts ...
0
votes
2
answers
3k
views
Add Permalink to Post Thumbnail, syntax code issues
I´d like to link the_post_thumbnail by using the the_permalink.
I do this (It Works without link)
<?php $args = array( 'post_type' => 'xyz', 'posts_per_page' => -1, 'orderby' => 'rand' ...
4
votes
2
answers
231
views
How do i structure my theme folder to avoid one huge list of files
When working with a worpress site with lots of custom post types and lots of page templates, my theme folder is looking messy. What are the accepted best practices to organise code files in WordPress?
...
1
vote
1
answer
91
views
Most liked page not displaying posts
I was looking for a post rating system for a while, then I stumbled across a great tutorial:
http://wp.tutsplus.com/tutorials/how-to-create-a-simple-post-rating-system-with-wordpress-and-jquery/
I ...
0
votes
1
answer
169
views
Themes with variable width or single columns? I want to display source code
I've just set up a new WordPress blog, and as a developer I want to post some source code as well. Now I found the suitable plug-ins I need, and also a sleek theme, or so I thought.
The problem is ...
1
vote
1
answer
568
views
If in category to be inside of a function
I have this code in WordPress index.php and I was wondering how can I transfer this in to a functions.php to be a part of a function?
<?php if (in_category('featured')) : ?>
<a href="<?...